|
|
| version 1.5, 2004/01/15 07:23:35 | version 1.6, 2004/01/31 20:05:24 |
|---|---|
| Line 38 extern HINSTANCE hPrev; | Line 38 extern HINSTANCE hPrev; |
| enum { | enum { |
| IDM_TRACEEN = 3300, | IDM_TRACEEN = 3300, |
| IDM_TRACEFH | IDM_TRACEFH, |
| IDM_TRACECL | |
| }; | }; |
| static const char ProgTitle[] = "console"; | static const char ProgTitle[] = "console"; |
| Line 46 static const char ClassName[] = "TRACE-c | Line 47 static const char ClassName[] = "TRACE-c |
| static const char ClassEdit[] = "EDIT"; | static const char ClassEdit[] = "EDIT"; |
| static const char traceen[] = "Enable"; | static const char traceen[] = "Enable"; |
| static const char tracefh[] = "File out"; | static const char tracefh[] = "File out"; |
| static const char tracecl[] = "Clear"; | |
| static const char crlf[] = "\r\n"; | |
| static TRACEWIN tracewin; | static TRACEWIN tracewin; |
| static HWND hView = NULL; | static HWND hView = NULL; |
| Line 71 static void View_ScrollToBottom(HWND hWn | Line 74 static void View_ScrollToBottom(HWND hWn |
| PostMessage(hWnd, EM_LINESCROLL, 0, MaxPos); | PostMessage(hWnd, EM_LINESCROLL, 0, MaxPos); |
| } | } |
| static void View_ClrString(void) { | |
| szView[0] = '\0'; | |
| SetWindowText(hView, szView); | |
| } | |
| static void View_AddString(const char *lpszString) { | static void View_AddString(const char *lpszString) { |
| int len, vlen; | int len, vlen; |
| Line 92 static void View_AddString(const char *l | Line 101 static void View_AddString(const char *l |
| strcpy(szView, p); | strcpy(szView, p); |
| } | } |
| strcat(szView, lpszString); | strcat(szView, lpszString); |
| strcat(szView, str_crlf); | strcat(szView, crlf); |
| SetWindowText(hView, szView); | SetWindowText(hView, szView); |
| View_ScrollToBottom(hView); | View_ScrollToBottom(hView); |
| } | } |
| Line 109 static LRESULT CALLBACK traceproc(HWND h | Line 118 static LRESULT CALLBACK traceproc(HWND h |
| IDM_TRACEEN, traceen); | IDM_TRACEEN, traceen); |
| InsertMenu(hmenu, 1, MF_BYPOSITION | MF_STRING, | InsertMenu(hmenu, 1, MF_BYPOSITION | MF_STRING, |
| IDM_TRACEFH, tracefh); | IDM_TRACEFH, tracefh); |
| InsertMenu(hmenu, 2, MF_BYPOSITION | MF_SEPARATOR, 0, NULL); | InsertMenu(hmenu, 2, MF_BYPOSITION | MF_STRING, |
| IDM_TRACECL, tracecl); | |
| InsertMenu(hmenu, 3, MF_BYPOSITION | MF_SEPARATOR, 0, NULL); | |
| CheckMenuItem(hmenu, IDM_TRACEEN, | CheckMenuItem(hmenu, IDM_TRACEEN, |
| (tracewin.en & 1)?MF_CHECKED:MF_UNCHECKED); | (tracewin.en & 1)?MF_CHECKED:MF_UNCHECKED); |
| Line 161 static LRESULT CALLBACK traceproc(HWND h | Line 172 static LRESULT CALLBACK traceproc(HWND h |
| MF_CHECKED:MF_UNCHECKED); | MF_CHECKED:MF_UNCHECKED); |
| break; | break; |
| case IDM_TRACECL: | |
| View_ClrString(); | |
| break; | |
| default: | default: |
| return(DefWindowProc(hWnd, msg, wp, lp)); | return(DefWindowProc(hWnd, msg, wp, lp)); |
| } | } |
| Line 249 void trace_init(void) { | Line 264 void trace_init(void) { |
| } | } |
| } | } |
| tracewin.en = 0; | #if 1 |
| tracewin.en = 1; | |
| tracewin.fh = FILEH_INVALID; | tracewin.fh = FILEH_INVALID; |
| #else | |
| tracewin.en = 0; | |
| tracewin.fh = file_create_c("out.txt"); | |
| #endif | |
| tracecfg.posx = CW_USEDEFAULT; | tracecfg.posx = CW_USEDEFAULT; |
| tracecfg.posy = CW_USEDEFAULT; | tracecfg.posy = CW_USEDEFAULT; |
| Line 270 void trace_init(void) { | Line 290 void trace_init(void) { |
| } | } |
| ShowWindow(hwnd, SW_SHOW); | ShowWindow(hwnd, SW_SHOW); |
| UpdateWindow(hwnd); | UpdateWindow(hwnd); |
| trace_fmt("start debugging..."); | |
| } | } |
| void trace_term(void) { | void trace_term(void) { |
| Line 302 void trace_fmt(const char *fmt, ...) { | Line 321 void trace_fmt(const char *fmt, ...) { |
| } | } |
| if (tracewin.fh != FILEH_INVALID) { | if (tracewin.fh != FILEH_INVALID) { |
| file_write(tracewin.fh, buf, strlen(buf)); | file_write(tracewin.fh, buf, strlen(buf)); |
| file_write(tracewin.fh, str_crlf, strlen(str_crlf)); | file_write(tracewin.fh, crlf, strlen(crlf)); |
| } | } |
| } | } |
| } | } |