diff --git a/configure.ac b/configure.ac index d9f6533c..8d73772d 100644 --- a/configure.ac +++ b/configure.ac @@ -2479,9 +2479,9 @@ dnl define _GNU_SOURCE for pthread_rwlock_t CFLAGS="$CFLAGS -D_GNU_SOURCE" if test "x$devel_mode" = "xyes"; then - CPPFLAGS="$CPPFLAGS -D_DEBUG" + CPPFLAGS="$CPPFLAGS -DDEBUG" if test "x$detail_debug" = "xyes"; then - CPPFLAGS="$CPPFLAGS -DDEBUG" + CPPFLAGS="$CPPFLAGS -D_DEBUG" fi if test "$ac_cv_prog_gcc" = "yes"; then diff --git a/include/common.h b/include/common.h index 3b71c359..20894e1f 100644 --- a/include/common.h +++ b/include/common.h @@ -2055,6 +2055,13 @@ int init_minigui_printf (int (*output_char) (int ch), #define TCS_CLRLINE(fp) #endif +#define _MG_PRINTF(fmt, ...) \ + do { \ + TCS_GREEN (stdout); \ + fprintf (stdout, fmt, ##__VA_ARGS__); \ + TCS_NONE (stdout); \ + } while (0) + #define _WRN_PRINTF(fmt, ...) \ do { \ TCS_PURPLE (stderr); \ @@ -2071,25 +2078,14 @@ int init_minigui_printf (int (*output_char) (int ch), TCS_NONE (stderr); \ } while (0) -#ifdef _DEBUG -# define _MG_PRINTF(fmt, ...) \ - do { \ - TCS_GREEN (stdout); \ - fprintf (stdout, fmt, ##__VA_ARGS__); \ - TCS_NONE (stdout); \ - } while (0) -# ifdef DEBUG -# define _DBG_PRINTF(fmt, ...) \ +#if defined(_DEBUG) +# define _DBG_PRINTF(fmt, ...) \ do { \ TCS_YELLOW (stderr); \ fprintf (stderr, fmt, ##__VA_ARGS__); \ TCS_NONE (stderr); \ } while (0) # else -# define _DBG_PRINTF(fmt, ...) -# endif -#else -# define _MG_PRINTF(fmt, ...) # define _DBG_PRINTF(fmt, ...) #endif diff --git a/src/control/bidiedit.c b/src/control/bidiedit.c index 2c28c8ea..55251cba 100644 --- a/src/control/bidiedit.c +++ b/src/control/bidiedit.c @@ -451,17 +451,17 @@ static void print_ranges(int* ranges, int nr_ranges, PBIDISLEDITDATA sled) int start_byte_index = get_achar_text_index(sled, sled->selStart); int end_byte_index = get_achar_text_index (sled, sled->selEnd); if(ranges){ - _MG_PRINTF("sel_achar-[%d,%d], sel_byte = [%d, %d]\n", + _DBG_PRINTF("sel_achar-[%d,%d], sel_byte = [%d, %d]\n", sled->selStart, sled->selEnd, start_byte_index, end_byte_index); - _MG_PRINTF("nr_ranges = %d.\n ranges = ", nr_ranges); + _DBG_PRINTF("nr_ranges = %d.\n ranges = ", nr_ranges); for (i=0; iselStart = sled->selEnd = 0; @@ -944,7 +944,7 @@ static void del_selected_text (HWND hWnd, PBIDISLEDITDATA sled) end_byte_index = MAX (s, e); - _MG_PRINTF("delete: sel_achar-[%d,%d], sel_byte = [%d, %d]\n", + _DBG_PRINTF("delete: sel_achar-[%d,%d], sel_byte = [%d, %d]\n", sled->selStart, sled->selEnd, start_byte_index, end_byte_index); @@ -1243,15 +1243,15 @@ get_insert_pos (PLOGFONT logfont, PBIDISLEDITDATA sled, char *newtext, static void print_text(PBIDISLEDITDATA sled) { int i; - _MG_PRINTF("sled->text = ["); + _DBG_PRINTF("sled->text = ["); for (i=0; itext = ["); + _DBG_PRINTF("sled->text = ["); for (i=0; ieditPos); + _DBG_PRINTF ("string = %s.\n", TEXT); + _DBG_PRINTF ("editPos = %d.\n", sled->editPos); for (i = 0; i < sled->achar_content.achars_len; i++) { - _MG_PRINTF ("map[%d] = %d,", i, + _DBG_PRINTF ("map[%d] = %d,", i, sled->achar_content.achar_map[i].byte_index); - _MG_PRINTF ("\n"); + _DBG_PRINTF ("\n"); } } #endif @@ -2488,7 +2488,7 @@ SLEditCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) unsigned char charBuffer [4]; int chars; - _MG_PRINTF("get char-----------------char----%p\n", (PVOID)wParam); + _DBG_PRINTF("get char-----------------char----%p\n", (PVOID)wParam); if (dwStyle & ES_READONLY) return 0; diff --git a/src/control/combobox.c b/src/control/combobox.c index 60af5d30..6040396a 100644 --- a/src/control/combobox.c +++ b/src/control/combobox.c @@ -352,7 +352,7 @@ static LRESULT ComboBoxCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM DWORD list_style, edit_style; if (!(pData = calloc (1, sizeof (COMBOBOXDATA)))) { - _MG_PRINTF ("CONTROL>ComboBox: Create control failure!\n"); + _WRN_PRINTF ("CONTROL>ComboBox: Create control failure!\n"); return -1; } diff --git a/src/control/listbox.c b/src/control/listbox.c index 940e3ac7..06d94d30 100644 --- a/src/control/listbox.c +++ b/src/control/listbox.c @@ -565,7 +565,7 @@ static void lstOnDrawSListBoxItems (HWND hWnd, HDC hdc, if (!pWin->we_rdr) { - _MG_PRINTF ("CONTROL>ListBox: NULL LFRDR.\n"); + _WRN_PRINTF ("CONTROL>ListBox: NULL LFRDR.\n"); return; } @@ -710,7 +710,7 @@ static int lstSelectItem (HWND hwnd, PLISTBOXDATA pData, int newSel) #ifdef _DEBUG if (!newItem) - _MG_PRINTF ("CONTROL>ListBox: return value of lstGetItem is NULL. \n"); + _WRN_PRINTF ("CONTROL>ListBox: return value of lstGetItem is NULL. \n"); #endif if (GetWindowStyle (hwnd) & LBS_MULTIPLESEL) { diff --git a/src/control/progressbar.c b/src/control/progressbar.c index 954fd57a..2e0a9dd3 100644 --- a/src/control/progressbar.c +++ b/src/control/progressbar.c @@ -104,7 +104,7 @@ ProgressBarCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { case MSG_CREATE: if (!(pData = malloc (sizeof (PROGRESSDATA)))) { - _MG_PRINTF ("CONTROL>ProgressBar: Create control failure!\n"); + _WRN_PRINTF ("CONTROL>ProgressBar: Create control failure!\n"); return -1; } diff --git a/src/control/scrollbar.c b/src/control/scrollbar.c index 7cd47ca4..d6705afb 100644 --- a/src/control/scrollbar.c +++ b/src/control/scrollbar.c @@ -174,13 +174,13 @@ static int init_sbdata (HWND hwnd, PSCROLLBARDATA pdata, RECT * scRect) if (!GetWindowRect (hwnd, scRect)) { - _MG_PRINTF ("ScrollBar Rect error!\n"); + _WRN_PRINTF ("ScrollBar Rect error!\n"); return -1; } if ((win_style & SBS_NOSHAFT) && (win_style & SBS_NOARROW)) { - _MG_PRINTF ("ScrollBar styles error!\n"); + _WRN_PRINTF ("ScrollBar styles error!\n"); return -1; } if (!(win_style & SBS_HORZ)) @@ -285,7 +285,7 @@ int track_thumb (HWND hwnd, PSCROLLBARDATA data, int x, int y) if (!data) { - _MG_PRINTF ("addtional data2 is NULL\n"); + _WRN_PRINTF ("addtional data2 is NULL\n"); return -1; } @@ -364,7 +364,7 @@ static LRESULT ScrollBarCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM /* create the main data construction for the control */ if (!(data = (PSCROLLBARDATA) malloc (sizeof (SCROLLBARDATA)))) { - _MG_PRINTF ("Create ScrollBar control failure!\n"); + _WRN_PRINTF ("Create ScrollBar control failure!\n"); return -1; } memset (data, 0 , sizeof (SCROLLBARDATA)); @@ -373,7 +373,7 @@ static LRESULT ScrollBarCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM if(0 != init_sbdata(hwnd, data, &rc)) { free(data); - _MG_PRINTF ("Create ScrollBar control failure!\n"); + _WRN_PRINTF ("Create ScrollBar control failure!\n"); return -1; } @@ -404,7 +404,7 @@ static LRESULT ScrollBarCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM if (!data) { - _MG_PRINTF ("addition data2 is NULL \n"); + _WRN_PRINTF ("addition data2 is NULL \n"); return 1; } @@ -1081,7 +1081,7 @@ static LRESULT ScrollBarCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM { if (info->nMax < info->nMin) { - _MG_PRINTF ( "Error range\n"); + _WRN_PRINTF ( "Error range\n"); return -1; } new_nMin = info->nMin; @@ -1093,7 +1093,7 @@ static LRESULT ScrollBarCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM if (info->nPage > new_nMax - new_nMin + 1 || info->nPage <= 0) { - _MG_PRINTF ( "Error page step\n"); + _WRN_PRINTF ( "Error page step\n"); return -1; } new_nPage = info->nPage; @@ -1112,7 +1112,7 @@ static LRESULT ScrollBarCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM if (info->nPos < new_nMin || info->nPos > new_nMax) { - _MG_PRINTF ( "Error postion to set"); + _WRN_PRINTF ( "Error postion to set"); return -1; } new_nPos = info->nPos; @@ -1171,7 +1171,7 @@ static LRESULT ScrollBarCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM if(max < data->curPos || min > data->curPos) { - _MG_PRINTF ( "Error range to set\n"); + _WRN_PRINTF ( "Error range to set\n"); return -1; } data->minPos = min; @@ -1200,7 +1200,7 @@ static LRESULT ScrollBarCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM if(max < data->curPos || min > data->curPos) { - _MG_PRINTF ( "Error range to set\n"); + _WRN_PRINTF ( "Error range to set\n"); return -1; } data->minPos = min; diff --git a/src/control/textedit.c b/src/control/textedit.c index 21b0ed16..74d32983 100644 --- a/src/control/textedit.c +++ b/src/control/textedit.c @@ -916,7 +916,7 @@ textdoc_insert_text (TextDoc *txtdoc, const char* newtext, int len) /* insert last strings */ /* FIXME */ if (!nextnode) { - _MG_PRINTF ("CONTROL>TextEdit: (Warning) nextnode is NULL!\n"); + _WRN_PRINTF ("CONTROL>TextEdit: (Warning) nextnode is NULL!\n"); /* set_current_node (txtdoc, LASTNODE(txtdoc), FALSE, TRUE); */ } else { @@ -1446,7 +1446,7 @@ static int get_line_nr (HWND hWnd, PTEDATA ptedata, TextNode *node, int indent) HDC hdc; if (!node) { - _MG_PRINTF ("CONTROL>TextEdit: (Warning) pass NULL text node to get_line_nr\n"); + _WRN_PRINTF ("CONTROL>TextEdit: (Warning) pass NULL text node to get_line_nr\n"); return 0; } @@ -1571,7 +1571,7 @@ set_line_width (HWND hWnd, PTEDATA ptedata, TextNode *node, int indent) HDC hdc; if (!node) { - _MG_PRINTF ("CONTROL>TextEdit: (Warning) pass NULL text node to set_line_width\n"); + _WRN_PRINTF ("CONTROL>TextEdit: (Warning) pass NULL text node to set_line_width\n"); return -1; } diff --git a/src/control/trackbar.c b/src/control/trackbar.c index d97a301f..a751f583 100644 --- a/src/control/trackbar.c +++ b/src/control/trackbar.c @@ -64,7 +64,7 @@ static void TrackBarOnDraw (HWND hwnd, HDC hdc, TRACKBARDATA* pData, DWORD dwSty win_rdr = GetWindowInfo(hwnd)->we_rdr; if (!win_rdr) { - _MG_PRINTF ("CONTROL>TrackBar: window renderer is NULL.\n"); + _WRN_PRINTF ("CONTROL>TrackBar: window renderer is NULL.\n"); return; } @@ -217,7 +217,7 @@ static LRESULT TrackBarCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM { case MSG_CREATE: if (!(pData = malloc (sizeof (TRACKBARDATA)))) { - _MG_PRINTF ("CONTROL>TrackBar: Create control failure!\n"); + _WRN_PRINTF ("CONTROL>TrackBar: Create control failure!\n"); return -1; } pData->nMax = 10; diff --git a/src/ex_ctrl/gif89a.c b/src/ex_ctrl/gif89a.c index 7828ece2..31ccaed0 100644 --- a/src/ex_ctrl/gif89a.c +++ b/src/ex_ctrl/gif89a.c @@ -216,7 +216,7 @@ static int LWZReadByte (MG_RWops *area, int flag, int input_code_size) while (code >= clear_code) { *sp++ = table[1][code]; if (code == table[0][code]) { - _MG_PRINTF ("EX_CTRL>GIF89a: circular table entry\n"); + _WRN_PRINTF ("EX_CTRL>GIF89a: circular table entry\n"); return -1; } code = table[0][code]; @@ -259,7 +259,7 @@ static int GetCode(MG_RWops *area, int code_size, int flag) if ((curbit + code_size) >= lastbit) { if (done) { if (curbit >= lastbit) - _MG_PRINTF ("EX_CTRL>GIF89a: bad decode\n"); + _WRN_PRINTF ("EX_CTRL>GIF89a: bad decode\n"); return -1; } buf[0] = buf[last_byte - 2]; @@ -362,7 +362,7 @@ static int ReadGIFGlobal (MG_RWops *area, GIFSCREEN* GifScreen) version [3] = '\0'; if (strcmp ((const char*)version, "87a") != 0 && strcmp ((const char*)version, "89a") != 0) { - _MG_PRINTF ("EX_CTRL>GIF89a: GIF version number not 87a or 89a.\n"); + _WRN_PRINTF ("EX_CTRL>GIF89a: GIF version number not 87a or 89a.\n"); return -1; /* image loading error*/ } @@ -373,7 +373,7 @@ static int ReadGIFGlobal (MG_RWops *area, GIFSCREEN* GifScreen) GifScreen->disposal = 0; if (!ReadOK (area, buf, 7)) { - _MG_PRINTF ("EX_CTRL>GIF89a: bad screen descriptor\n"); + _WRN_PRINTF ("EX_CTRL>GIF89a: bad screen descriptor\n"); return -1; /* image loading error*/ } GifScreen->Width = LM_to_uint (buf[0], buf[1]); @@ -384,10 +384,10 @@ static int ReadGIFGlobal (MG_RWops *area, GIFSCREEN* GifScreen) GifScreen->AspectRatio = buf[6]; if (BitSet(buf[4], LOCALCOLORMAP)) { /* Global Colormap */ - _MG_PRINTF ("EX_CTRL>GIF89a: have global colormap: %d\n", + _WRN_PRINTF ("EX_CTRL>GIF89a: have global colormap: %d\n", GifScreen->Background); if (ReadColorMap (area, GifScreen->BitPixel, GifScreen->ColorMap)) { - _MG_PRINTF ("EX_CTRL>GIF89a: bad global colormap\n"); + _WRN_PRINTF ("EX_CTRL>GIF89a: bad global colormap\n"); return -1; /* image loading error*/ } } @@ -399,7 +399,7 @@ static int ReadImageDesc (MG_RWops *area, IMAGEDESC* ImageDesc, GIFSCREEN* GifSc { unsigned char buf[16]; if (!ReadOK (area, buf, 9)) { - _MG_PRINTF ("EX_CTRL>GIF89a: bad image size\n"); + _WRN_PRINTF ("EX_CTRL>GIF89a: bad image size\n"); return -1; } @@ -414,9 +414,9 @@ static int ReadImageDesc (MG_RWops *area, IMAGEDESC* ImageDesc, GIFSCREEN* GifSc ImageDesc->interlace = BitSet(buf[8], INTERLACE); if (ImageDesc->haveColorMap) { - _MG_PRINTF ("EX_CTRL>GIF89a: have local colormap\n"); + _WRN_PRINTF ("EX_CTRL>GIF89a: have local colormap\n"); if (ReadColorMap (area, ImageDesc->bitPixel, ImageDesc->ColorMap) < 0) { - _MG_PRINTF ("EX_CTRL>GIF89a: bad local colormap\n"); + _WRN_PRINTF ("EX_CTRL>GIF89a: bad local colormap\n"); return -1; } } else { @@ -437,12 +437,12 @@ static int ReadImage (MG_RWops* area, MYBITMAP* bmp, IMAGEDESC* ImageDesc, GIFSC * initialize the compression routines */ if (!ReadOK (area, &c, 1)) { - _MG_PRINTF ("EX_CTRL>GIF89a: eof on image data\n"); + _WRN_PRINTF ("EX_CTRL>GIF89a: eof on image data\n"); return -1; } if (LWZReadByte (area, TRUE, c) < 0) { - _MG_PRINTF ("EX_CTRL>GIF89a: error reading image\n"); + _WRN_PRINTF ("EX_CTRL>GIF89a: error reading image\n"); return -1; } @@ -549,11 +549,11 @@ ANIMATION* CreateAnimationFromGIF89a (HDC hdc, MG_RWops* area) anim->bk.a = 0; } - _MG_PRINTF ("EX_CTRL>GIF89a: Background: %d, %d, %d.\n", + _WRN_PRINTF ("EX_CTRL>GIF89a: Background: %d, %d, %d.\n", anim->bk.r, anim->bk.g, anim->bk.b); if ((ok = ReadOK (area, &c, 1)) == 0) { - _MG_PRINTF ("EX_CTRL>GIF89a: EOF on image data\n"); + _WRN_PRINTF ("EX_CTRL>GIF89a: EOF on image data\n"); goto error; } @@ -561,11 +561,11 @@ ANIMATION* CreateAnimationFromGIF89a (HDC hdc, MG_RWops* area) switch (c) { case '!': if ( (ok = ReadOK (area, &c, 1)) == 0) { - _MG_PRINTF ("EX_CTRL>GIF89a: EOF on image data\n"); + _WRN_PRINTF ("EX_CTRL>GIF89a: EOF on image data\n"); goto error; } DoExtension (area, c, &GifScreen); - _MG_PRINTF ("EX_CTRL>GIF89a: Extension info: %d, %d, %d, %d, %d, %d\n", + _WRN_PRINTF ("EX_CTRL>GIF89a: Extension info: %d, %d, %d, %d, %d, %d\n", GifScreen.Width, GifScreen.Height, GifScreen.AspectRatio, GifScreen.delayTime, GifScreen.disposal, GifScreen.transparent); @@ -579,7 +579,7 @@ ANIMATION* CreateAnimationFromGIF89a (HDC hdc, MG_RWops* area) if (ReadImage (area, &mybmp, &ImageDesc, &GifScreen, 0) < 0) goto error; } - _MG_PRINTF ("EX_CTRL>GIF89a: Image Descriptor: %d, %d, %d, %d, %d\n", + _WRN_PRINTF ("EX_CTRL>GIF89a: Image Descriptor: %d, %d, %d, %d, %d\n", ImageDesc.Top, ImageDesc.Left, ImageDesc.Width, ImageDesc.Height, ImageDesc.haveColorMap); @@ -595,14 +595,14 @@ ANIMATION* CreateAnimationFromGIF89a (HDC hdc, MG_RWops* area) frame->width = mybmp.w; frame->height = mybmp.h; frame->delay_time = (GifScreen.delayTime>10)?GifScreen.delayTime:10; - _MG_PRINTF ("EX_CTRL>GIF89a: frame info: %d, %d, %d, %d\n", + _WRN_PRINTF ("EX_CTRL>GIF89a: frame info: %d, %d, %d, %d\n", frame->off_x, frame->off_y, frame->delay_time, GifScreen.transparent); if ((frame->mem_dc = CreateMemDCFromMyBitmap (&mybmp, ImageDesc.ColorMap)) == 0) { free (mybmp.bits); free (frame); - _MG_PRINTF ("EX_CTRL>GIF89a: Error when expand frame bitmap.\n"); + _WRN_PRINTF ("EX_CTRL>GIF89a: Error when expand frame bitmap.\n"); goto error; } frame->bits = mybmp.bits; diff --git a/src/ex_ctrl/gridviewcelltype.c b/src/ex_ctrl/gridviewcelltype.c index f6b70242..9543a8a0 100644 --- a/src/ex_ctrl/gridviewcelltype.c +++ b/src/ex_ctrl/gridviewcelltype.c @@ -1108,7 +1108,7 @@ void GridCellTypeNumber_set_text_value(gvGridCellData* cell, int row, int col, c if (INF[0] != 'I' && INF[0] != 'i') cell->data.number.num = number; else - _MG_PRINTF ("EX_CTRL>Grid: The inputed number is too big!\n"); + _WRN_PRINTF ("EX_CTRL>Grid: The inputed number is too big!\n"); } double GridCellTypeNumber_get_double_value(gvGridCellData* cell, int row, int col) diff --git a/src/font/devfont.c b/src/font/devfont.c index f429ab08..7c6f57b4 100644 --- a/src/font/devfont.c +++ b/src/font/devfont.c @@ -536,24 +536,24 @@ static DEVFONT* make_devfont (const char* font_name, void* data, BOOL is_filenam } if (fontops_info->type == NULL) { - _MG_PRINTF ("FONT>DevFont: invalid font type: %s.\n", font_name); + _WRN_PRINTF ("FONT>DevFont: invalid font type: %s.\n", font_name); return NULL; } /*find the first charset*/ if (!fontGetCharsetFromName (font_name, charset)) { - _MG_PRINTF ("FONT>DevFont: Invalid charset name: %s.\n", font_name); + _WRN_PRINTF ("FONT>DevFont: Invalid charset name: %s.\n", font_name); return NULL; } if ((charset_ops = GetCharsetOpsEx (charset)) == NULL) { - _MG_PRINTF ("FONT>DevFont: Invalid charset name %s of font %s.\n", + _WRN_PRINTF ("FONT>DevFont: Invalid charset name %s of font %s.\n", charset, font_name); return NULL; } if (find_devfont(font_name, (charset_ops->bytes_maxlen_char > 1))) { - _MG_PRINTF ("FONT>DevFont: Duplicated devfont name (%s).\n", + _WRN_PRINTF ("FONT>DevFont: Duplicated devfont name (%s).\n", font_name); return NULL; } @@ -569,7 +569,7 @@ static DEVFONT* make_devfont (const char* font_name, void* data, BOOL is_filenam font_name, data); if (devfont->data == NULL) { - _MG_PRINTF ("FONT>DevFont: error in loading font %s from %s file\n", + _WRN_PRINTF ("FONT>DevFont: error in loading font %s from %s file\n", font_name, (const char*) data); free (devfont); return NULL; @@ -724,7 +724,7 @@ BOOL font_InitIncoreFonts (void) #ifdef _MGFONT_RBF for (i = 0; i < NR_RBFONTS; i++) { if (!add_dev_font (incore_rbfonts [i]->name, incore_rbfonts [i]->data, FALSE)) { - _MG_PRINTF ("FONT>DevFont: can not init incore font: %s\n", incore_rbfonts [i]->name); + _WRN_PRINTF ("FONT>DevFont: can not init incore font: %s\n", incore_rbfonts [i]->name); return FALSE; } } @@ -733,7 +733,7 @@ BOOL font_InitIncoreFonts (void) #ifdef _MGFONT_VBF for (i = 0; i < NR_VBFONTS && incore_vbfonts[i]; i++) { if (!add_dev_font (incore_vbfonts [i]->name, incore_vbfonts [i], FALSE)) { - _MG_PRINTF ("FONT>DevFont: can not init incore font: %s\n", incore_vbfonts [i]->name); + _WRN_PRINTF ("FONT>DevFont: can not init incore font: %s\n", incore_vbfonts [i]->name); return FALSE; } } @@ -743,7 +743,7 @@ BOOL font_InitIncoreFonts (void) for (i = 0; i < NR_UPFONTS && incore_upfonts[i]; i++) { const char* name = ((UPFV1_FILE_HEADER*)(incore_upfonts [i]->root_dir))->font_name; if (!add_dev_font (name, incore_upfonts [i], FALSE)) { - _MG_PRINTF ("FONT>DevFont: can not init incore font: %s\n", name); + _WRN_PRINTF ("FONT>DevFont: can not init incore font: %s\n", name); return FALSE; } } @@ -751,7 +751,7 @@ BOOL font_InitIncoreFonts (void) #ifdef _MGFONT_SEF if(!initialize_scripteasy()) { - _MG_PRINTF (stderr, "GDI: Can not initialize ScriptEasy fonts!\n"); + _WRN_PRINTF (stderr, "GDI: Can not initialize ScriptEasy fonts!\n"); return FALSE; } #endif @@ -920,7 +920,7 @@ static BOOL init_or_term_specifical_fonts (char* etc_section, BOOL is_unload) /*get font number in minigui etc*/ if (GetMgEtcIntValue (etc_section, "font_number", &font_num) < 0 ) { - _MG_PRINTF ("FONT>DevFont: can't find font_number in section %s.\n", + _WRN_PRINTF ("FONT>DevFont: can't find font_number in section %s.\n", etc_section); return FALSE; } @@ -929,14 +929,14 @@ static BOOL init_or_term_specifical_fonts (char* etc_section, BOOL is_unload) for (i=0; iDevFont: can't get name of key %s in section %s.\n", + _WRN_PRINTF ("FONT>DevFont: can't get name of key %s in section %s.\n", key, etc_section); continue; } snprintf (key, sizeof(key)-1, "fontfile%d", i); if (GetMgEtcValue (etc_section, key, font_file_name, MAX_PATH) < 0) { - _MG_PRINTF ("FONT>DevFont: can't get font_file of key %s in section %s.\n", + _WRN_PRINTF ("FONT>DevFont: can't get font_file of key %s in section %s.\n", key, etc_section); continue; } diff --git a/src/font/fontname.c b/src/font/fontname.c index b1a783c5..4a2bef23 100644 --- a/src/font/fontname.c +++ b/src/font/fontname.c @@ -44,8 +44,6 @@ #include #include -#define DEBUG - #include "common.h" #include "minigui.h" #include "gdi.h" diff --git a/src/font/freetype1.c b/src/font/freetype1.c index aa462c68..df0e5c95 100644 --- a/src/font/freetype1.c +++ b/src/font/freetype1.c @@ -76,7 +76,7 @@ static void* load_font_data (DEVFONT* devfont, const char* font_name, const char /* Load face */ if (TT_Open_Face (ttf_engine, file_name, &ttf_glyph_info->face) != TT_Err_Ok) { - _MG_PRINTF ("FONT>FT1: TT_Open_Face error.\n"); + _WRN_PRINTF ("FONT>FT1: TT_Open_Face error.\n"); goto error_after_create_info; } @@ -119,7 +119,7 @@ static void* load_font_data (DEVFONT* devfont, const char* font_name, const char } if (i == n) { - _MG_PRINTF ("FONT>FT1: no unicode map table\n"); + _WRN_PRINTF ("FONT>FT1: no unicode map table\n"); goto error_after_create_face; } @@ -129,7 +129,7 @@ static void* load_font_data (DEVFONT* devfont, const char* font_name, const char = (properties.num_Glyphs > 255) ? 255 : properties.num_Glyphs - 1; if (TT_New_Glyph (ttf_glyph_info->face, &ttf_glyph_info->glyph) != TT_Err_Ok) { - _MG_PRINTF ("FONT>FT1: TT_New_Glyph error.\n"); + _WRN_PRINTF ("FONT>FT1: TT_New_Glyph error.\n"); goto error_after_create_face; } ttf_inst_info->ttf_glyph_info = ttf_glyph_info; @@ -820,7 +820,7 @@ BOOL font_InitFreetypeLibrary (void) #ifdef _MGFONT_TTF_CACHE if (__mg_ttc_sys_init(_MGMAX_TTF_CACHE, _MGTTF_CACHE_SIZE * 1024)) { - _MG_PRINTF ("FONT>FT1: init ttf cache sys failed\n"); + _WRN_PRINTF ("FONT>FT1: init ttf cache sys failed\n"); goto error_library; } #endif diff --git a/src/font/freetype2.c b/src/font/freetype2.c index 15bfbf5e..7bc3bbff 100644 --- a/src/font/freetype2.c +++ b/src/font/freetype2.c @@ -296,12 +296,12 @@ load_or_search_glyph (FTINSTANCEINFO* ft_inst_info, FT_Face* face, *face = ft_face_info->face; ft_inst_info->cur_index = gv; if (FT_Load_Glyph (*face, ft_inst_info->cur_index, ft_load_flags)) { - _MG_PRINTF ("FONT>FT2: FT_Load_Glyph error\n"); + _WRN_PRINTF ("FONT>FT2: FT_Load_Glyph error\n"); return -1; } if (FT_Get_Glyph ((*face)->glyph, &(ft_inst_info->glyph))) { - _MG_PRINTF ("FONT>FT2: FT_Get_Glyph error\n"); + _WRN_PRINTF ("FONT>FT2: FT_Get_Glyph error\n"); return -1; } @@ -310,19 +310,19 @@ load_or_search_glyph (FTINSTANCEINFO* ft_inst_info, FT_Face* face, FT_Glyph ft_glyph_tmp; if (get_cached_face (ft_inst_info, face)) { - _MG_PRINTF ("FONT>FT2: can't access font file %p\n", face); + _WRN_PRINTF ("FONT>FT2: can't access font file %p\n", face); return 0; } ft_inst_info->cur_index = gv; if (FTC_ImageCache_Lookup (ft_image_cache, &ft_inst_info->image_type, ft_inst_info->cur_index, &ft_glyph_tmp, NULL)) { - _MG_PRINTF ("FONT>FT2: can't access image cache.\n"); + _WRN_PRINTF ("FONT>FT2: can't access image cache.\n"); return -1; } if (FT_Glyph_Copy (ft_glyph_tmp, &ft_inst_info->glyph)) { - _MG_PRINTF ("FONT>FT2: can't copy glyph from cache.\n"); + _WRN_PRINTF ("FONT>FT2: can't copy glyph from cache.\n"); return -1; } @@ -854,7 +854,7 @@ new_instance (LOGFONT* logfont, DEVFONT* devfont, BOOL need_sbc_font) if (FTC_Manager_LookupFace (ft_cache_manager, (FTC_FaceID)ft_face_info, &face)) { /* can't access the font file. do not render anything */ - _MG_PRINTF ("FONT>FT2: can't access font file %p\n", ft_face_info); + _WRN_PRINTF ("FONT>FT2: can't access font file %p\n", ft_face_info); goto out_lock; } #else @@ -1023,7 +1023,7 @@ static Glyph32 get_glyph_value (LOGFONT* logfont, DEVFONT* devfont, Achar32 ac) gv = FT_Get_Char_Index (face, uc); #else /* !_MGFONT_TTF_CACHE */ if (get_cached_face (ft_inst_info, &face)) { - _MG_PRINTF ("FONT>FT2: can't access cached face %p\n", ft_inst_info->ft_face_info); + _WRN_PRINTF ("FONT>FT2: can't access cached face %p\n", ft_inst_info->ft_face_info); goto error; } @@ -1242,7 +1242,7 @@ BOOL font_InitFreetypeLibrary (void) #endif if (__mg_ttc_sys_init (_MGMAX_TTF_CACHE, _MGTTF_CACHE_SIZE * 1024)) { - _MG_PRINTF ("FONT>FT2: init ttf cache sys failed\n"); + _WRN_PRINTF ("FONT>FT2: init ttf cache sys failed\n"); goto error_library; } diff --git a/src/font/harzbuff-minigui-funcs.c b/src/font/harzbuff-minigui-funcs.c index 26df6115..14bc4dc3 100644 --- a/src/font/harzbuff-minigui-funcs.c +++ b/src/font/harzbuff-minigui-funcs.c @@ -44,8 +44,6 @@ #include #include -#define DEBUG - #include "common.h" #if defined(_MGCHARSET_UNICODE) && defined(_MGCOMPLEX_SCRIPTS) diff --git a/src/font/qpf.c b/src/font/qpf.c index 4458dec0..75a07542 100644 --- a/src/font/qpf.c +++ b/src/font/qpf.c @@ -164,14 +164,14 @@ static void* load_font_data (DEVFONT* devfont, const char* font_name, const char qpf_info = (QPFINFO*) calloc (1, sizeof(QPFINFO)); if (!(fp = fopen (file_name, "rb"))) { - _MG_PRINTF ("FONT>QPF: open file error: %s.\n", + _WRN_PRINTF ("FONT>QPF: open file error: %s.\n", file_name); goto error; } file_size = get_opened_file_size (fp); if (file_size == 0) { - _MG_PRINTF ("FONT>QPF: empty font file: %s.\n", + _WRN_PRINTF ("FONT>QPF: empty font file: %s.\n", file_name); goto error; } @@ -180,14 +180,14 @@ static void* load_font_data (DEVFONT* devfont, const char* font_name, const char if ((qpf_info->height = fontGetHeightFromName (font_name)) == -1) { - _MG_PRINTF ("FONT>QPF: Invalid font name (height): %s.\n", + _WRN_PRINTF ("FONT>QPF: Invalid font name (height): %s.\n", font_name); goto error; } if ((qpf_info->width = fontGetWidthFromName (font_name)) == -1) { - _MG_PRINTF ("FONT>QPF: Invalid font name (width): %s.\n", + _WRN_PRINTF ("FONT>QPF: Invalid font name (width): %s.\n", font_name); goto error; } diff --git a/src/font/unicode-bidi.c b/src/font/unicode-bidi.c index 736c9b77..47bf6e45 100644 --- a/src/font/unicode-bidi.c +++ b/src/font/unicode-bidi.c @@ -72,7 +72,7 @@ #include "bidi.h" #include "unicode-bidi.h" -#ifdef DEBUG +#ifdef _DEBUG #include @@ -98,7 +98,7 @@ static inline void validate_run_list(BidiRun *run_list) // do nothing. } -#endif /* !DEBUG */ +#endif /* !_DEBUG */ static BidiRun* new_run(void) { @@ -452,7 +452,7 @@ static BidiRun *get_adjacent_run(BidiRun *list, return ppp; } -#ifdef DEBUG +#ifdef _DEBUG /*====================================================================== * For debugging, define some functions for printing the types and the * levels. @@ -551,7 +551,7 @@ static void print_pairing_nodes(BidiPairingNode *nodes) _DBG_PRINTF ("\n"); } -#endif /* DEBUG */ +#endif /* _DEBUG */ /*========================================================================= * define macros for push and pop the status in to / out of the stack @@ -802,9 +802,9 @@ BidiLevel UBidiGetParagraphEmbeddingLevels(const BidiType *bidi_types, base_level_per_iso_level[0] = base_level; -#ifdef DEBUG +#ifdef _DEBUG print_types_re (main_run_list); -#endif /* DEBUG */ +#endif /* _DEBUG */ /* Explicit Levels and Directions */ _DBG_PRINTF ("explicit levels and directions\n"); @@ -1044,12 +1044,12 @@ BidiLevel UBidiGetParagraphEmbeddingLevels(const BidiType *bidi_types, compact_list (main_run_list); -#ifdef DEBUG +#ifdef _DEBUG print_types_re (main_run_list); print_bidi_string (bidi_types, len); print_resolved_levels (main_run_list); print_resolved_types (main_run_list); -#endif /* DEBUG */ +#endif /* _DEBUG */ /* 4. Resolving weak types. Also calculate the maximum isolate level */ max_iso_level = 0; @@ -1224,10 +1224,10 @@ BidiLevel UBidiGetParagraphEmbeddingLevels(const BidiType *bidi_types, compact_neutrals (main_run_list); -#ifdef DEBUG +#ifdef _DEBUG print_resolved_levels (main_run_list); print_resolved_types (main_run_list); -#endif /* DEBUG */ +#endif /* _DEBUG */ /* 5. Resolving Neutral Types */ @@ -1307,9 +1307,9 @@ BidiLevel UBidiGetParagraphEmbeddingLevels(const BidiType *bidi_types, /* The list must now be sorted for the next algo to work! */ sort_pairing_nodes(&pairing_nodes); -#ifdef DEBUG +#ifdef _DEBUG print_pairing_nodes (pairing_nodes); -#endif /* DEBUG */ +#endif /* _DEBUG */ /* Start the N0 */ { @@ -1398,10 +1398,10 @@ BidiLevel UBidiGetParagraphEmbeddingLevels(const BidiType *bidi_types, } } -#ifdef DEBUG +#ifdef _DEBUG print_resolved_levels (main_run_list); print_resolved_types (main_run_list); -#endif /* DEBUG */ +#endif /* _DEBUG */ } _DBG_PRINTF ("resolving neutral types - N1+N2\n"); @@ -1437,10 +1437,10 @@ BidiLevel UBidiGetParagraphEmbeddingLevels(const BidiType *bidi_types, compact_list (main_run_list); -#ifdef DEBUG +#ifdef _DEBUG print_resolved_levels (main_run_list); print_resolved_types (main_run_list); -#endif /* DEBUG */ +#endif /* _DEBUG */ /* 6. Resolving implicit levels */ _DBG_PRINTF ("resolving implicit levels\n"); @@ -1471,11 +1471,11 @@ BidiLevel UBidiGetParagraphEmbeddingLevels(const BidiType *bidi_types, compact_list (main_run_list); -#ifdef DEBUG +#ifdef _DEBUG print_bidi_string (bidi_types, len); print_resolved_levels (main_run_list); print_resolved_types (main_run_list); -#endif /* DEBUG */ +#endif /* _DEBUG */ /* Reinsert the explicit codes & BN's that are already removed, from the explicits_list to main_run_list. */ @@ -1496,11 +1496,11 @@ BidiLevel UBidiGetParagraphEmbeddingLevels(const BidiType *bidi_types, p->level = p->prev->level; } -#ifdef DEBUG +#ifdef _DEBUG print_types_re (main_run_list); print_resolved_levels (main_run_list); print_resolved_types (main_run_list); -#endif /* DEBUG */ +#endif /* _DEBUG */ _DBG_PRINTF ("reset the embedding levels, 1, 2, 3.\n"); { @@ -1554,11 +1554,11 @@ BidiLevel UBidiGetParagraphEmbeddingLevels(const BidiType *bidi_types, if (!shadow_run_list (main_run_list, list, FALSE)) goto out; } -#ifdef DEBUG +#ifdef _DEBUG print_types_re (main_run_list); print_resolved_levels (main_run_list); print_resolved_types (main_run_list); -#endif /* DEBUG */ +#endif /* _DEBUG */ { int pos = 0; @@ -1821,7 +1821,8 @@ BidiLevel GUIAPI UBidiGetParagraphEmbeddingLevelsAlt( max_level = UBidiGetParagraphEmbeddingLevels(bidi_ts, brk_ts, nr_ucs, &base_dir, els); if (max_level == 0) { - _DBG_PRINTF("%s: failed to get paragraph embedding levels.\n"); + _DBG_PRINTF("%s: failed to get paragraph embedding levels.\n", + __FUNCTION__); memset (els, 0, nr_ucs); } } diff --git a/src/font/unicode-joining.c b/src/font/unicode-joining.c index cb5875c0..8bbcb932 100644 --- a/src/font/unicode-joining.c +++ b/src/font/unicode-joining.c @@ -58,7 +58,7 @@ #include "unicode-bidi.h" -#ifdef DEBUG +#ifdef _DEBUG /*====================================================================== * For debugging, define some functions for printing joining types and * properties. @@ -91,7 +91,7 @@ static void print_joining_types(const BidiLevel *embedding_levels, _DBG_PRINTF ("\n"); } -#endif /* DEBUG */ +#endif /* _DEBUG */ #define UNIBIDI_CONSISTENT_LEVEL(i) \ (BIDI_IS_EXPLICIT_OR_BN (bidi_types[(i)]) \ @@ -107,9 +107,9 @@ void GUIAPI UBidiJoinArabic(const BidiType *bidi_types, { if (len == 0) return; -#ifdef DEBUG +#ifdef _DEBUG print_joining_types (embedding_levels, len, ar_props); -#endif /* DEBUG */ +#endif /* _DEBUG */ /* The joining algorithm turned out very very dirty :(. That's what happens * when you follow the standard which has never been implemented closely @@ -187,9 +187,10 @@ void GUIAPI UBidiJoinArabic(const BidiType *bidi_types, } -#ifdef DEBUG +#ifdef _DEBUG print_joining_types (embedding_levels, len, ar_props); -#endif /* DEBUG */ +#endif /* _DEBUG */ } #endif /* _MGCHARSET_UNICODE */ + diff --git a/src/font/upf.c b/src/font/upf.c index 8e27dade..c9017690 100644 --- a/src/font/upf.c +++ b/src/font/upf.c @@ -67,24 +67,24 @@ static void* load_font_data (DEVFONT* devfont, const char* font_name, const char int tmp; if ((tmp = fontGetWidthFromName (font_name)) == -1) { - _MG_PRINTF ("FONT>UPF: Invalid font name (width): %s.\n", font_name); + _WRN_PRINTF ("FONT>UPF: Invalid font name (width): %s.\n", font_name); goto error; } upf_info->width = (Uint8)tmp; if ((tmp = fontGetHeightFromName (font_name)) == -1) { - _MG_PRINTF ("FONT>UPF: Invalid font name (height): %s.\n", font_name); + _WRN_PRINTF ("FONT>UPF: Invalid font name (height): %s.\n", font_name); goto error; } upf_info->height = (Uint8)tmp; if ((fp = fopen (file_name, "rb")) == NULL) { - _MG_PRINTF ("FONT>UPF: can't open font file: %s\n", file_name); + _WRN_PRINTF ("FONT>UPF: can't open font file: %s\n", file_name); goto error; } if ((file_size = get_opened_file_size (fp)) <= 0) { - _MG_PRINTF ("FONT>UPF: empty font file: %s\n", file_name); + _WRN_PRINTF ("FONT>UPF: empty font file: %s\n", file_name); goto error; } diff --git a/src/gui/ctrlclass.c b/src/gui/ctrlclass.c index bf017d35..72837e18 100644 --- a/src/gui/ctrlclass.c +++ b/src/gui/ctrlclass.c @@ -226,70 +226,70 @@ BOOL mg_InitControlClass () #ifdef _MGCTRL_TREEVIEW if (!RegisterTreeViewControl ()) { - _MG_PRINTF ("Init MiniGUI control error: TreeView.\n"); + _WRN_PRINTF ("Init MiniGUI control error: TreeView.\n"); return FALSE; } #endif #ifdef _MGCTRL_TREEVIEW_RDR if (!RegisterTreeViewRdrControl ()) { - _MG_PRINTF ("Init MiniGUI control error: TreeView_rdr.\n"); + _WRN_PRINTF ("Init MiniGUI control error: TreeView_rdr.\n"); return FALSE; } #endif #ifdef _MGCTRL_MONTHCAL if (!RegisterMonthCalendarControl ()) { - _MG_PRINTF ("Init MiniGUI control error: MonthCalendar.\n"); + _WRN_PRINTF ("Init MiniGUI control error: MonthCalendar.\n"); return FALSE; } #endif #ifdef _MGCTRL_SPINBOX if (!RegisterSpinControl ()) { - _MG_PRINTF ("Init MiniGUI control error: Spin.\n"); + _WRN_PRINTF ("Init MiniGUI control error: Spin.\n"); return FALSE; } #endif #ifdef _MGCTRL_COOLBAR if (!RegisterCoolBarControl ()) { - _MG_PRINTF ("Init MiniGUI control error: CoolBar.\n"); + _WRN_PRINTF ("Init MiniGUI control error: CoolBar.\n"); return FALSE; } #endif #ifdef _MGCTRL_LISTVIEW if (!RegisterListViewControl ()) { - _MG_PRINTF ("Init MiniGUI control error: ListView.\n"); + _WRN_PRINTF ("Init MiniGUI control error: ListView.\n"); return FALSE; } #endif #ifdef _MGCTRL_GRIDVIEW if (!RegisterGridViewControl ()) { - _MG_PRINTF ("Init MiniGUI control error: GridView.\n"); + _WRN_PRINTF ("Init MiniGUI control error: GridView.\n"); return FALSE; } #endif #ifdef _MGCTRL_ICONVIEW if (!RegisterIconViewControl ()) { - _MG_PRINTF ("Init MiniGUI control error: IconView.\n"); + _WRN_PRINTF ("Init MiniGUI control error: IconView.\n"); return FALSE; } #endif #ifdef _MGCTRL_ANIMATION if (!RegisterAnimationControl ()) { - _MG_PRINTF ("Init MiniGUI control error: Animation.\n"); + _WRN_PRINTF ("Init MiniGUI control error: Animation.\n"); return FALSE; } #endif #ifdef _MGCTRL_SCROLLBAR if (!RegisterScrollBarControl ()) { - _MG_PRINTF ("Init MiniGUI control error: ScrollBar.\n"); + _WRN_PRINTF ("Init MiniGUI control error: ScrollBar.\n"); return FALSE; } #endif diff --git a/src/gui/lf_common.c b/src/gui/lf_common.c index 9cdf7d5e..7b1e71e5 100644 --- a/src/gui/lf_common.c +++ b/src/gui/lf_common.c @@ -64,7 +64,7 @@ char* gui_GetIconFile(const char* rdr_name, char* file, char* _szValue) if (GetMgEtcValue (rdr_name, file, iconname, sizeof(szValue)-(iconname-szValue)) < 0 ) { - _MG_PRINTF ("SYSRES: can't get %s's value from section %s in etc.\n", + _WRN_PRINTF ("SYSRES: can't get %s's value from section %s in etc.\n", file, rdr_name); return NULL; } @@ -81,7 +81,7 @@ BOOL gui_LoadIconRes(HDC hdc, const char* rdr_name, char* file) if (LoadResource(szValue, RES_TYPE_ICON, (DWORD)hdc) != NULL) return TRUE; - _MG_PRINTF ("SYSRES: can't get %s's value from section %s in etc.\n", + _WRN_PRINTF ("SYSRES: can't get %s's value from section %s in etc.\n", file, rdr_name); return FALSE; diff --git a/src/gui/lf_manager.c b/src/gui/lf_manager.c index a75604fa..246b8874 100644 --- a/src/gui/lf_manager.c +++ b/src/gui/lf_manager.c @@ -605,30 +605,30 @@ void dump_window_element_data (HWND hwnd) return; if (pwnd->wed == NULL) { - _MG_PRINTF ("GUI>DumpWED: No attributes in list.\n"); + _WRN_PRINTF ("GUI>DumpWED: No attributes in list.\n"); return; } - _MG_PRINTF ("GUI>DumpWED: The attributes of window elements:\n"); + _WRN_PRINTF ("GUI>DumpWED: The attributes of window elements:\n"); list_for_each (me, &pwnd->wed->list) { wed = list_entry (me, WND_ELEMENT_DATA, list); switch (wed->id & WE_ATTR_TYPE_MASK) { case WE_ATTR_TYPE_FONT: - _MG_PRINTF ("\tfont in list:%s-%s-%s.\n", + _WRN_PRINTF ("\tfont in list:%s-%s-%s.\n", ((PLOGFONT)(wed->data))->type, ((PLOGFONT)(wed->data))->family, ((PLOGFONT)(wed->data))->charset); break; case WE_ATTR_TYPE_METRICS: - _MG_PRINTF ("\tmetrics in list:%d.\n", (int)wed->data); + _WRN_PRINTF ("\tmetrics in list:%d.\n", (int)wed->data); break; case WE_ATTR_TYPE_COLOR: - _MG_PRINTF ("\tcolor in list: %p.\n", (PVOID)wed->data); + _WRN_PRINTF ("\tcolor in list: %p.\n", (PVOID)wed->data); } } - _MG_PRINTF ("GUI>DumpWED: Done\n"); + _WRN_PRINTF ("GUI>DumpWED: Done\n"); } #endif /* _DEBUG */ @@ -723,7 +723,7 @@ GetWindowElementPixelEx (HWND hwnd, HDC hdc, int we_attr_id) gal_pixel pixel; if ((we_attr_id & WE_ATTR_TYPE_MASK) != WE_ATTR_TYPE_COLOR) { - _MG_PRINTF ("GUI: Can't get color; invalid attr id: %x.\n", we_attr_id); + _WRN_PRINTF ("GUI: Can't get color; invalid attr id: %x.\n", we_attr_id); return -1; } @@ -795,7 +795,7 @@ BOOL GUIAPI InitWindowElementAttrs (PWERENDERER rdr) if (!rdr || !rdr->name || rdr->name[0] == '\0') return FALSE; - _MG_PRINTF ("GUI>InitWEA: Initialize %s renderer window element attributes.\n", + _WRN_PRINTF ("GUI>InitWEA: Initialize %s renderer window element attributes.\n", rdr->name); for (i = 0; i < WE_METRICS_NUMBER; i++) { @@ -821,7 +821,7 @@ BOOL GUIAPI InitWindowElementAttrs (PWERENDERER rdr) if (szCKeyNames[i][j]) { if (GetMgEtcValue (rdr->name, szCKeyNames[i][j], buff, 12) != ETC_OK) { - _MG_PRINTF ("GUI>InitWEA: InitWindowElementAttrs error: \ + _WRN_PRINTF ("GUI>InitWEA: InitWindowElementAttrs error: \ Can not Get %s color. \n", szCKeyNames[i][j]); return FALSE; } @@ -851,7 +851,7 @@ BOOL mg_InitLFManager (void) return FALSE; if (rdr->init && 0 != rdr->init (rdr)) { - _MG_PRINTF ("GUI>InitLFM: failed to initialize default renderer's private info.\n"); + _WRN_PRINTF ("GUI>InitLFM: failed to initialize default renderer's private info.\n"); return FALSE; } @@ -863,7 +863,7 @@ BOOL mg_InitLFManager (void) if (rdr->init && 0 != rdr->init (rdr)) { wnd_lf_info[i].wnd_rdr = NULL; - _MG_PRINTF ("GUI>InitLFM: fail to initialize renderer[%d]'s private info.\n", i); + _WRN_PRINTF ("GUI>InitLFM: fail to initialize renderer[%d]'s private info.\n", i); continue; } } diff --git a/src/gui/menu.c b/src/gui/menu.c index 8de23212..3de3b996 100644 --- a/src/gui/menu.c +++ b/src/gui/menu.c @@ -1368,7 +1368,7 @@ static void mnuDrawMenuBarItem (HWND hwnd, HDC hdc, PMENUITEM pmi, return; if (!pWin->we_rdr) { - _MG_PRINTF ("GUI>Menu: LFRDR is NULL for window: %p\n", pWin); + _WRN_PRINTF ("GUI>Menu: LFRDR is NULL for window: %p\n", pWin); return; } @@ -2009,7 +2009,7 @@ static int mnuDrawMenuPic (HWND hwnd, HDC hdc, RECT* rect, if (NULL == pWin) return -1; if (!pWin->we_rdr) { - _MG_PRINTF ("GUI>Menu: LFRDR is NULL for window: %p\n", pWin); + _WRN_PRINTF ("GUI>Menu: LFRDR is NULL for window: %p\n", pWin); return -1; } @@ -2254,7 +2254,7 @@ static void draw_bottom_scroll_button(PTRACKMENUINFO ptmi) if (NULL == pWin) return; if (!pWin->we_rdr) { - _MG_PRINTF ("GUI>Menu: LFRDR is NULL for window: %p\n", pWin); + _WRN_PRINTF ("GUI>Menu: LFRDR is NULL for window: %p\n", pWin); return; } @@ -2294,7 +2294,7 @@ static int mnuShowPopupMenu (PTRACKMENUINFO ptmi) if (NULL == pWin) return -1; if (!pWin->we_rdr) { - _MG_PRINTF ("GUI>Menu: LFRDR is NULL for window: %p\n", pWin); + _WRN_PRINTF ("GUI>Menu: LFRDR is NULL for window: %p\n", pWin); return -1; } @@ -2614,7 +2614,7 @@ static void draw_top_scroll_button(PTRACKMENUINFO ptmi) if (NULL == pWin) return; if (!pWin->we_rdr) { - _MG_PRINTF ("GUI>Menu: LFRDR is NULL for window: %p\n", pWin); + _WRN_PRINTF ("GUI>Menu: LFRDR is NULL for window: %p\n", pWin); return; } @@ -2657,7 +2657,7 @@ static int show_scroll_popup_menu (PTRACKMENUINFO ptmi) if (NULL == pWin) return -1; if (!pWin->we_rdr) { - _MG_PRINTF ("GUI>Menu: LFRDR is NULL for window: %p\n", pWin); + _WRN_PRINTF ("GUI>Menu: LFRDR is NULL for window: %p\n", pWin); return -1; } @@ -3087,7 +3087,7 @@ static void mnuHiliteMenuItem (PTRACKMENUINFO ptmi, PMENUITEM pmi, BOOL bHilite) if (NULL == pWin) return; if (!pWin->we_rdr) { - _MG_PRINTF ("GUI>Menu: LFRDR is NULL for window: %p\n", pWin); + _WRN_PRINTF ("GUI>Menu: LFRDR is NULL for window: %p\n", pWin); return; } diff --git a/src/gui/window.c b/src/gui/window.c index 37b10c15..323e4a5f 100644 --- a/src/gui/window.c +++ b/src/gui/window.c @@ -3517,10 +3517,10 @@ void GUIAPI MainWindowThreadCleanup (HWND hMainWnd) { PMAINWIN pWin = (PMAINWIN)hMainWnd; - _MG_PRINTF ("GUI>Window: MainWindowThreadCleanup called: %p (%s)\n", pWin, pWin->spCaption); + _WRN_PRINTF ("GUI>Window: MainWindowThreadCleanup called: %p (%s)\n", pWin, pWin->spCaption); if (!MG_IS_DESTROYED_WINDOW (hMainWnd)) { - _MG_PRINTF ("GUI>Window: Unexpected calling of " + _WRN_PRINTF ("GUI>Window: Unexpected calling of " "(MainWindowThreadCleanup); Window (%p) " "not destroyed yet!\n", hMainWnd); return; @@ -3529,7 +3529,7 @@ void GUIAPI MainWindowThreadCleanup (HWND hMainWnd) #ifdef _MGRM_THREADS if (pWin->pHosting == NULL) { mg_FreeMsgQueueThisThread (); - _MG_PRINTF ("GUI>Window: Message queure is freed: %p (%s)\n", pWin, pWin->spCaption); + _WRN_PRINTF ("GUI>Window: Message queure is freed: %p (%s)\n", pWin, pWin->spCaption); } #endif @@ -5964,7 +5964,7 @@ static int gui_GenerateMaskRect(HWND hWnd, RECT4MASK* rect, int rect_size) (MASKRECT *) calloc (rect_size, sizeof (MASKRECT)); if (!pCtrl->mask_rects) { - _MG_PRINTF ("GUI>Window: Not enough memory!\n"); + _WRN_PRINTF ("GUI>Window: Not enough memory!\n"); free (rect); return FALSE; } @@ -5979,7 +5979,7 @@ static int gui_GenerateMaskRect(HWND hWnd, RECT4MASK* rect, int rect_size) new_maskrect = (MASKRECT *) calloc (rect_size, sizeof (MASKRECT)); if (!new_maskrect) { - _MG_PRINTF ("GUI>Window: Not enough memory!\n"); + _WRN_PRINTF ("GUI>Window: Not enough memory!\n"); free (rect); return FALSE; } @@ -6094,7 +6094,7 @@ BOOL GUIAPI SetWindowRegion (HWND hWnd, const CLIPRGN * region) (MASKRECT *) calloc (rect_size, sizeof (MASKRECT)); if (!pCtrl->mask_rects) { - _MG_PRINTF ("GUI>Window: Not enough memory!\n"); + _WRN_PRINTF ("GUI>Window: Not enough memory!\n"); return FALSE; } } @@ -6108,7 +6108,7 @@ BOOL GUIAPI SetWindowRegion (HWND hWnd, const CLIPRGN * region) (MASKRECT *) calloc (rect_size, sizeof (MASKRECT)); if (!new_maskrect) { - _MG_PRINTF ("GUI>Window: Not enough memory!\n"); + _WRN_PRINTF ("GUI>Window: Not enough memory!\n"); return FALSE; } free (pCtrl->mask_rects); @@ -6144,7 +6144,7 @@ BOOL GUIAPI SetWindowRegion (HWND hWnd, const CLIPRGN * region) rect = (RECT4MASK *) calloc(rect_size, sizeof(RECT4MASK)); if(rect == NULL) { - _MG_PRINTF ("GUI>Window: Not enough memory!\n"); + _WRN_PRINTF ("GUI>Window: Not enough memory!\n"); return FALSE; } diff --git a/src/ial/ial.c b/src/ial/ial.c index b64b3c93..f3625867 100644 --- a/src/ial/ial.c +++ b/src/ial/ial.c @@ -265,7 +265,7 @@ int mg_InitIAL (void) _ERR_PRINTF ("IAL: Does not find the request engine: %s.\n", engine); if (NR_INPUTS) { __mg_cur_input = inputs; - _MG_PRINTF ("IAL: Use the first engine: %s\n", __mg_cur_input->id); + _WRN_PRINTF ("IAL: Use the first engine: %s\n", __mg_cur_input->id); } else return ERR_NO_MATCH; diff --git a/src/ial/ipaq-h3600.c b/src/ial/ipaq-h3600.c index a1ccd3a6..38ce764a 100644 --- a/src/ial/ipaq-h3600.c +++ b/src/ial/ipaq-h3600.c @@ -251,13 +251,13 @@ BOOL InitIPAQH3600Input (INPUT* input, const char* mdev, const char* mtype) { ts = open (TS_DEVICE, O_RDONLY); if (ts < 0) { - _MG_PRINTF ("IAL>%s: Can not open touch screen!\n", __FILE__); + _WRN_PRINTF ("IAL>%s: Can not open touch screen!\n", __FILE__); return FALSE; } btn_fd = open (KBD_DEVICE, O_RDONLY); if (btn_fd < 0 ) { - _MG_PRINTF ("IAL>%s: Can not open button key!\n", __FILE__); + _WRN_PRINTF ("IAL>%s: Can not open button key!\n", __FILE__); return FALSE; } diff --git a/src/ial/ipaq-h5400.c b/src/ial/ipaq-h5400.c index 3aff8a3c..101ba331 100644 --- a/src/ial/ipaq-h5400.c +++ b/src/ial/ipaq-h5400.c @@ -379,13 +379,13 @@ BOOL InitIPAQH5400Input (INPUT* input, const char* mdev, const char* mtype) { ts_fd = open (mdev, O_RDONLY); if (ts_fd < 0) { - _MG_PRINTF ("IAL>%s: Can not open touch screen device: %s!\n", __FILE__, mdev); + _WRN_PRINTF ("IAL>%s: Can not open touch screen device: %s!\n", __FILE__, mdev); return FALSE; } kbd_fd = TTY_Open (); if (kbd_fd < 0 ) { - _MG_PRINTF ("IAL>%s: Can not open button key!\n", __FILE__); + _WRN_PRINTF ("IAL>%s: Can not open button key!\n", __FILE__); return FALSE; } diff --git a/src/ial/jz4740.c b/src/ial/jz4740.c index 995bffee..7edc87f3 100644 --- a/src/ial/jz4740.c +++ b/src/ial/jz4740.c @@ -338,7 +338,7 @@ BOOL InitJZ4740Input(INPUT* input, const char* mdev, const char* mtype) touch_fd = open (TS_DEVICE, O_NONBLOCK); if (!touch_fd) { - _MG_PRINTF ("IAL>TSLib: can not open ts device\n"); + _WRN_PRINTF ("IAL>TSLib: can not open ts device\n"); return FALSE; } diff --git a/src/ial/lide.c b/src/ial/lide.c index 250a7b93..be5ae3f7 100644 --- a/src/ial/lide.c +++ b/src/ial/lide.c @@ -341,7 +341,7 @@ BOOL InitlideInput(INPUT* input, const char* mdev, const char* mtype) touch_fd = open (TS_DEVICE, O_NONBLOCK); if (!touch_fd) { - _MG_PRINTF ("IAL>TSLib: can not open ts device\n"); + _WRN_PRINTF ("IAL>TSLib: can not open ts device\n"); return FALSE; } diff --git a/src/ial/tslibial.c b/src/ial/tslibial.c index bd066532..5e1a9ff0 100644 --- a/src/ial/tslibial.c +++ b/src/ial/tslibial.c @@ -140,19 +140,19 @@ BOOL InitTSLibInput(INPUT* input, const char* mdev, const char* mtype) } if (tsdevice == NULL) { - _MG_PRINTF ("IAL>TSLib: Please specify the ts device\n"); + _WRN_PRINTF ("IAL>TSLib: Please specify the ts device\n"); return FALSE; } ts = ts_open (tsdevice, 0); if (!ts) { - _MG_PRINTF ("IAL>TSLib: can not open ts device\n"); + _WRN_PRINTF ("IAL>TSLib: can not open ts device\n"); return FALSE; } if (ts_config (ts)) { - _MG_PRINTF ("IAL>TSLib: can not config ts device\n"); + _WRN_PRINTF ("IAL>TSLib: can not config ts device\n"); return FALSE; } diff --git a/src/kernel/cursor-comm.c b/src/kernel/cursor-comm.c index cbd263ea..a534b79c 100644 --- a/src/kernel/cursor-comm.c +++ b/src/kernel/cursor-comm.c @@ -52,7 +52,7 @@ static HCURSOR load_cursor_from_file (const char* filename) /* the cbType of struct CURSORDIR. */ wTemp = MGUI_ReadLE16FP (fp); if(wTemp != 2) { - _MG_PRINTF ("LoadCursorFromFile: bad file type: %d\n", wTemp); + _WRN_PRINTF ("LoadCursorFromFile: bad file type: %d\n", wTemp); goto error; } @@ -63,7 +63,7 @@ static HCURSOR load_cursor_from_file (const char* filename) w = fgetc (fp); /* the width of first cursor. */ h = fgetc (fp); /* the height of first cursor. */ if (w != CURSORWIDTH || h != CURSORHEIGHT) { - _MG_PRINTF ("LoadCursorFromFile: bad first cursor width (%d) and height (%d)\n", w, h); + _WRN_PRINTF ("LoadCursorFromFile: bad first cursor width (%d) and height (%d)\n", w, h); goto error; } @@ -85,21 +85,21 @@ static HCURSOR load_cursor_from_file (const char* filename) imagew = MGUI_ReadLE32FP (fp); imageh = MGUI_ReadLE32FP (fp); if (imagew != CURSORWIDTH || imageh != (CURSORHEIGHT*2)) { - _MG_PRINTF ("LoadCursorFromFile: bad cursor image width (%d) and height (%d)\n", imagew, imageh); + _WRN_PRINTF ("LoadCursorFromFile: bad cursor image width (%d) and height (%d)\n", imagew, imageh); goto error; } /* check the biPlanes member; */ wTemp = MGUI_ReadLE16FP (fp); if (wTemp != 1) { - _MG_PRINTF ("LoadCursorFromFile: bad planes (%d)\n", wTemp); + _WRN_PRINTF ("LoadCursorFromFile: bad planes (%d)\n", wTemp); goto error; } /* check the biBitCount member; */ wTemp = MGUI_ReadLE16FP (fp); if (wTemp > 4) { - _MG_PRINTF ("LoadCursorFromFile: bad bit count (%d)\n", wTemp); + _WRN_PRINTF ("LoadCursorFromFile: bad bit count (%d)\n", wTemp); goto error; } @@ -112,13 +112,13 @@ static HCURSOR load_cursor_from_file (const char* filename) /* allocate memory for image. */ if ((image = (BYTE*)ALLOCATE_LOCAL (imagesize)) == NULL) { - _MG_PRINTF ("LoadCursorFromFile: error when allocating memory for image (%d)\n", imagesize); + _WRN_PRINTF ("LoadCursorFromFile: error when allocating memory for image (%d)\n", imagesize); goto error; } /* read image */ if (fread (image, 1, imagesize, fp) < imagesize) { - _MG_PRINTF ("LoadCursorFromFile: error when reading data from file\n"); + _WRN_PRINTF ("LoadCursorFromFile: error when reading data from file\n"); goto error; } @@ -130,7 +130,7 @@ static HCURSOR load_cursor_from_file (const char* filename) return csr; error: - _MG_PRINTF ("LoadCursorFromFile: failed when loading cursor from %s\n", filename); + _WRN_PRINTF ("LoadCursorFromFile: failed when loading cursor from %s\n", filename); fclose (fp); return csr; } @@ -201,7 +201,7 @@ static HCURSOR load_cursor_from_mem (const void* area) p + (imagesize - MONOSIZE), p, colornum); error: - _MG_PRINTF ("LoadCursorFromMem: failed when loading cursor from %p\n", area); + _WRN_PRINTF ("LoadCursorFromMem: failed when loading cursor from %p\n", area); return 0; } diff --git a/src/kernel/desktop-comm.c b/src/kernel/desktop-comm.c index 8a0333ea..2fce762f 100644 --- a/src/kernel/desktop-comm.c +++ b/src/kernel/desktop-comm.c @@ -195,7 +195,7 @@ static int dskAddNewMainWindow (PMAINWIN pWin) pWin->idx_znode = dskAllocZOrderNode (pWin); if (pWin->idx_znode <= 0) { - _MG_PRINTF ("KERNEL>Desktop: Alloc zorder node for main window fail.\n"); + _WRN_PRINTF ("KERNEL>Desktop: Alloc zorder node for main window fail.\n"); return -1; } @@ -1218,7 +1218,7 @@ static int dskStartDragWindow (PMAINWIN pWin, const DRAGINFO* drag_info) SetCursor (GetSystemCursor (IDC_SIZENESW)); break; default: - _MG_PRINTF ("KERNEL>Desktop: Drag and drop window: bad location\n"); + _WRN_PRINTF ("KERNEL>Desktop: Drag and drop window: bad location\n"); break; } @@ -1297,7 +1297,7 @@ static int do_drag_drop_window (UINT msg, int x, int y) break; default: - _MG_PRINTF ("KERNEL>Desktop: do_drag_drop_window: bad location\n"); + _WRN_PRINTF ("KERNEL>Desktop: do_drag_drop_window: bad location\n"); break; } @@ -1735,7 +1735,7 @@ static int dskOnNewCtrlInstance (PCONTROL pParent, PCONTROL pNewCtrl) pNewCtrl->idx_znode = dskAllocZOrderNode ((PMAINWIN)pNewCtrl); if (pNewCtrl->idx_znode <= 0) { - _MG_PRINTF ("KERNEL>Desktop: Alloc zorder node for control fail.\n"); + _WRN_PRINTF ("KERNEL>Desktop: Alloc zorder node for control fail.\n"); return -1; } diff --git a/src/kernel/desktop-procs.c b/src/kernel/desktop-procs.c index a7ff50ec..32449dad 100644 --- a/src/kernel/desktop-procs.c +++ b/src/kernel/desktop-procs.c @@ -882,7 +882,7 @@ static int srvStartDragWindow (int cli, int idx_znode, SetCursor (GetSystemCursor (IDC_SIZENESW)); break; default: - _MG_PRINTF ("KERNEL>Desktop: Drag and drop window: bad location\n"); + _WRN_PRINTF ("KERNEL>Desktop: Drag and drop window: bad location\n"); break; } @@ -980,7 +980,7 @@ int __mg_do_drag_drop_window (int msg, int x, int y) break; default: - _MG_PRINTF ("KERNEL>Desktop: __mg_do_drag_drop_window: bad location\n"); + _WRN_PRINTF ("KERNEL>Desktop: __mg_do_drag_drop_window: bad location\n"); break; } diff --git a/src/kernel/desktop-sa.c b/src/kernel/desktop-sa.c index 8e53c9e2..9c133711 100644 --- a/src/kernel/desktop-sa.c +++ b/src/kernel/desktop-sa.c @@ -96,7 +96,7 @@ BOOL mg_InitDesktop (void) */ ret = kernel_alloc_z_order_info (DEF_NR_TOPMOSTS, DEF_NR_NORMALS); if (ret < 0) { - _MG_PRINTF ("KERNEL>Desktop: Can not initialize ZOrderInfo!\n"); + _WRN_PRINTF ("KERNEL>Desktop: Can not initialize ZOrderInfo!\n"); return FALSE; } diff --git a/src/kernel/desktop-ths.c b/src/kernel/desktop-ths.c index 426a3b32..4427e0b3 100644 --- a/src/kernel/desktop-ths.c +++ b/src/kernel/desktop-ths.c @@ -104,7 +104,7 @@ BOOL mg_InitDesktop (void) ret = kernel_alloc_z_order_info (DEF_NR_TOPMOSTS, DEF_NR_NORMALS); if (ret < 0) { - _MG_PRINTF ("KERNEL>Desktop: Can not initialize ZOrderInfo!\n"); + _WRN_PRINTF ("KERNEL>Desktop: Can not initialize ZOrderInfo!\n"); return FALSE; } @@ -120,7 +120,7 @@ BOOL mg_InitDesktop (void) // Init Window Management information. if (!InitWndManagementInfo()) { - _MG_PRINTF ("KERNEL>Desktop: Can not initialize window management information!\n"); + _WRN_PRINTF ("KERNEL>Desktop: Can not initialize window management information!\n"); return FALSE; } @@ -133,7 +133,7 @@ void* DesktopMain (void* data) /* init message queue of desktop thread */ if (!(__mg_dsk_msg_queue = mg_InitMsgQueueThisThread ()) ) { - _MG_PRINTF ("KERNEL>Desktop: mg_InitMsgQueueThisThread failure!\n"); + _WRN_PRINTF ("KERNEL>Desktop: mg_InitMsgQueueThisThread failure!\n"); return NULL; } diff --git a/src/kernel/desktop.c b/src/kernel/desktop.c index 6d4c822d..40e850ac 100644 --- a/src/kernel/desktop.c +++ b/src/kernel/desktop.c @@ -1493,7 +1493,7 @@ int CreateNodeRoundMaskRect (ZORDERINFO* zi, ZORDERNODE* node, (unsigned char*)GET_MASKRECT_USAGEBMP(zi), zi->size_maskrect_usage_bmp, 1); if (free_slot == -1) { - _MG_PRINTF ("KERNEL: __mg_lookfor_unused_slot failed\n"); + _WRN_PRINTF ("KERNEL: __mg_lookfor_unused_slot failed\n"); return -1; } diff --git a/src/kernel/message.c b/src/kernel/message.c index 61af4671..dd485af4 100644 --- a/src/kernel/message.c +++ b/src/kernel/message.c @@ -490,7 +490,7 @@ BOOL PeekMessageEx (PMSG pMsg, HWND hWnd, UINT nMsgFilterMin, UINT nMsgFilterMax #ifdef _MGRM_THREADS if (!(pMsgQueue = GetMsgQueueThisThread ())) { - _MG_PRINTF ("Kernel>message: no message queue.\n"); + _WRN_PRINTF ("Kernel>message: no message queue.\n"); return FALSE; } #else diff --git a/src/kernel/timer.c b/src/kernel/timer.c index 20a9209a..8e39d8a8 100644 --- a/src/kernel/timer.c +++ b/src/kernel/timer.c @@ -383,7 +383,7 @@ BOOL GUIAPI SetTimerEx (HWND hWnd, LINT id, DWORD speed, PMSGQUEUE pMsgQueue; if (id == 0) { - _MG_PRINTF ("KERNEL>Timer: bad identifier (%ld).\n", id); + _WRN_PRINTF ("KERNEL>Timer: bad identifier (%ld).\n", id); return FALSE; } @@ -393,7 +393,7 @@ BOOL GUIAPI SetTimerEx (HWND hWnd, LINT id, DWORD speed, #ifdef _MGRM_THREADS if (!(pMsgQueue = GetMsgQueueThisThread ())) { - _MG_PRINTF ("KERNEL>Timer: Not a GUI thread.\n"); + _WRN_PRINTF ("KERNEL>Timer: Not a GUI thread.\n"); return FALSE; } #else @@ -409,13 +409,13 @@ BOOL GUIAPI SetTimerEx (HWND hWnd, LINT id, DWORD speed, slot = i; } else if (timerstr[i]->hWnd == hWnd && timerstr[i]->id == id) { - _MG_PRINTF ("KERNEL>Timer: duplicated call to SetTimerEx (%p, %ld).\n", hWnd, id); + _WRN_PRINTF ("KERNEL>Timer: duplicated call to SetTimerEx (%p, %ld).\n", hWnd, id); goto badret; } } if (slot < 0 || slot == DEF_NR_TIMERS) { - _MG_PRINTF ("KERNEL>Timer: No more slot for new timer (total: %d)\n", DEF_NR_TIMERS); + _WRN_PRINTF ("KERNEL>Timer: No more slot for new timer (total: %d)\n", DEF_NR_TIMERS); goto badret; } diff --git a/src/kernel/zorder.c b/src/kernel/zorder.c index a6ad8d79..b00e9205 100644 --- a/src/kernel/zorder.c +++ b/src/kernel/zorder.c @@ -125,7 +125,7 @@ int kernel_alloc_z_order_info (int nr_topmosts, int nr_normals) sizeof (MASKRECT) * DEF_NR_MASKRECT); if (!__mg_zorder_info) { - _MG_PRINTF ("KERNEL>ZOrder: calloc zorderinfo failure. \n"); + _WRN_PRINTF ("KERNEL>ZOrder: calloc zorderinfo failure. \n"); return -1; } diff --git a/src/misc/clipboard.c b/src/misc/clipboard.c index db0100f0..c7b5a167 100644 --- a/src/misc/clipboard.c +++ b/src/misc/clipboard.c @@ -80,7 +80,7 @@ static int create_clip_board (const char* cb_name, size_t size) for (i = 0; i < NR_CLIPBOARDS; i++) { if (strncmp (cb_name, cbs [i].name, LEN_CLIPBOARD_NAME) == 0) { - _MG_PRINTF ("MISC>ClipBoard: create error: already existed.\n"); + _WRN_PRINTF ("MISC>ClipBoard: create error: already existed.\n"); return CBERR_BADNAME; } if (empty < 0 && cbs [i].name [0] == '\0') { diff --git a/src/misc/rwops.c b/src/misc/rwops.c index 1dbde30d..c671af50 100644 --- a/src/misc/rwops.c +++ b/src/misc/rwops.c @@ -130,7 +130,7 @@ static int mem_seek(MG_RWops *context, int offset, int whence) newpos = context->hidden.mem.stop+offset; break; default: - _MG_PRINTF ("MISC>RWOps: Unknown value for 'whence'\n"); + _WRN_PRINTF ("MISC>RWOps: Unknown value for 'whence'\n"); return(-1); } if ( newpos < context->hidden.mem.base ) { @@ -257,7 +257,7 @@ MG_RWops *MGUI_RWFromFile(const char *file, const char *mode) fp = fopen(file, (char*)mode); #endif if ( fp == NULL ) { - _MG_PRINTF ("MISC>RWOps: Couldn't open %s\n", file); + _WRN_PRINTF ("MISC>RWOps: Couldn't open %s\n", file); } else { rwops = MGUI_RWFromFP(fp, 1); } @@ -339,7 +339,7 @@ MG_RWops *MGUI_AllocRW(void) area = (MG_RWops *)malloc(sizeof *area); if ( area == NULL ) { - _MG_PRINTF ("MISC>RWOps: Out of memory\n"); + _WRN_PRINTF ("MISC>RWOps: Out of memory\n"); } else area->type = RWAREA_TYPE_UNKNOWN; diff --git a/src/mybmp/gif.c b/src/mybmp/gif.c index 904f3734..9644a8ef 100644 --- a/src/mybmp/gif.c +++ b/src/mybmp/gif.c @@ -121,7 +121,7 @@ void* __mg_init_gif (MG_RWops* fp, MYBITMAP *gif, RGB *pal) version [3] = '\0'; if (strcmp(version, "87a") != 0 && strcmp(version, "89a") != 0) { - _MG_PRINTF ("MYBMP>Gif: GIF version number is not 87a or 89a\n"); + _WRN_PRINTF ("MYBMP>Gif: GIF version number is not 87a or 89a\n"); return NULL; /* image loading error*/ } @@ -139,7 +139,7 @@ void* __mg_init_gif (MG_RWops* fp, MYBITMAP *gif, RGB *pal) info->gif89.disposal = 0; if (!ReadOK (fp, buf, 7)) { - _MG_PRINTF ("MYBMP>Gif: bad screen descriptor\n"); + _WRN_PRINTF ("MYBMP>Gif: bad screen descriptor\n"); goto fini; /* image loading error*/ } @@ -152,7 +152,7 @@ void* __mg_init_gif (MG_RWops* fp, MYBITMAP *gif, RGB *pal) if (BitSet(buf[4], LOCALCOLORMAP)) { /* Global Colormap */ if (ReadColorMap(fp, info->screen.BitPixel, info->screen.ColorMap)) { - _MG_PRINTF ("MYBMP>Gif: bad global colormap\n"); + _WRN_PRINTF ("MYBMP>Gif: bad global colormap\n"); goto fini; /* image loading error*/ } } @@ -160,12 +160,12 @@ void* __mg_init_gif (MG_RWops* fp, MYBITMAP *gif, RGB *pal) do { if (!ReadOK (fp, &c, 1)) { - _MG_PRINTF ("MYBMP>Gif: EOF on image data\n"); + _WRN_PRINTF ("MYBMP>Gif: EOF on image data\n"); goto fini; } if (';' == c) {/* GIF terminator */ - _MG_PRINTF ("MYBMP>Gif: no image \n" ); + _WRN_PRINTF ("MYBMP>Gif: no image \n" ); goto fini; } @@ -199,7 +199,7 @@ void* __mg_init_gif (MG_RWops* fp, MYBITMAP *gif, RGB *pal) if (!ReadOK (fp, buf, 9)) { /* Read the Image Descriptor*/ - _MG_PRINTF ("MYBMP>Gif: bad image size\n"); + _WRN_PRINTF ("MYBMP>Gif: bad image size\n"); goto fini; } @@ -209,7 +209,7 @@ void* __mg_init_gif (MG_RWops* fp, MYBITMAP *gif, RGB *pal) if (!info->useGColormap) { memset (info->screen.ColorMap , 0 , 3*256); if (0 != ReadColorMap(fp, info->bitPixel, info->screen.ColorMap)) { - _MG_PRINTF ("MYBMP>Gif: bad local colormap\n"); + _WRN_PRINTF ("MYBMP>Gif: bad local colormap\n"); goto fini; } } @@ -337,7 +337,7 @@ GetCode(MG_RWops *src, int code_size, int flag , void * info) if ((curbit + code_size) >= lastbit) { if (done) { if (curbit >= lastbit) - _MG_PRINTF ("MYBMP>Gif: bad decode\n"); + _WRN_PRINTF ("MYBMP>Gif: bad decode\n"); return -1; } buf[0] = buf[last_byte - 2]; @@ -430,7 +430,7 @@ LWZReadByte(MG_RWops *src, int flag, int input_code_size , void * info_data) while ((count = GetDataBlock(src, buf , info)) > 0); if (count != 0) { - _MG_PRINTF ("MYBMP>Gif: missing EOD in data stream (common occurence)"); + _WRN_PRINTF ("MYBMP>Gif: missing EOD in data stream (common occurence)"); } return -2; } @@ -443,7 +443,7 @@ LWZReadByte(MG_RWops *src, int flag, int input_code_size , void * info_data) while (code >= clear_code) { *sp++ = table[1][code]; if (code == table[0][code]) { - _MG_PRINTF ("MYBMP>Gif: circular table entry\n"); + _WRN_PRINTF ("MYBMP>Gif: circular table entry\n"); return -1; } code = table[0][code]; @@ -481,11 +481,11 @@ ReadImage(MG_RWops* src, MYBITMAP* bmp, int len, int height, * Initialize the compression routines */ if (!ReadOK(src, &c, 1)) { - _MG_PRINTF ("MYBMP>Gif: EOF on image data\n"); + _WRN_PRINTF ("MYBMP>Gif: EOF on image data\n"); return 0; } if (LWZReadByte(src, TRUE, c , info) < 0) { - _MG_PRINTF ("MYBMP>Gif: error reading image\n"); + _WRN_PRINTF ("MYBMP>Gif: error reading image\n"); return 0; } diff --git a/src/mybmp/mybmp.c b/src/mybmp/mybmp.c index 82799214..e3f9cc03 100644 --- a/src/mybmp/mybmp.c +++ b/src/mybmp/mybmp.c @@ -363,7 +363,7 @@ int GUIAPI SaveMyBitmapToFile (PMYBITMAP my_bmp, RGB* pal, const char* spFileNam return ERR_BMP_CANT_SAVE; if (!(fp = MGUI_RWFromFile (spFileName, "wb+"))) { - _MG_PRINTF ("MYBMP>WinBMP: Saving BMP file: fopen error.\n"); + _WRN_PRINTF ("MYBMP>WinBMP: Saving BMP file: fopen error.\n"); return ERR_BMP_FILEIO; } diff --git a/src/newgal/fbcon/pci_smi.c b/src/newgal/fbcon/pci_smi.c index 0abb1b39..ad84bbf8 100644 --- a/src/newgal/fbcon/pci_smi.c +++ b/src/newgal/fbcon/pci_smi.c @@ -150,7 +150,7 @@ static BOOL SMI_MapMem (_THIS) break; } - _MG_PRINTF ("NEWGAL>FBCON>SMI: Physical MMIO at 0x%08lX\n", (unsigned long)memBase); + _DBG_PRINTF ("NEWGAL>FBCON>SMI: Physical MMIO at 0x%08lX\n", (unsigned long)memBase); { void** result = (void*)(&pSmi->MapBase); @@ -161,13 +161,13 @@ static BOOL SMI_MapMem (_THIS) result); if (err) { perror ("pci_device_map_range"); - _MG_PRINTF ("NEWGAL>FBCON>SMI: pci_device_map_range failure: %s.\n", strerror (err)); + _WRN_PRINTF ("NEWGAL>FBCON>SMI: pci_device_map_range failure: %s.\n", strerror (err)); return FALSE; } } if (pSmi->MapBase == NULL) { - _MG_PRINTF ("NEWGAL>FBCON>SMI: Internal error: could not map MMIO registers.\n"); + _WRN_PRINTF ("NEWGAL>FBCON>SMI: Internal error: could not map MMIO registers.\n"); return FALSE; } @@ -216,11 +216,11 @@ static BOOL SMI_MapMem (_THIS) break; } - _MG_PRINTF ("NEWGAL>FBCON>SMI: Logical MMIO at %p - %p\n", pSmi->MapBase, + _DBG_PRINTF ("NEWGAL>FBCON>SMI: Logical MMIO at %p - %p\n", pSmi->MapBase, pSmi->MapBase + pSmi->MapSize - 1); - _MG_PRINTF ("NEWGAL>FBCON>SMI: DPR=%p, VPR=%p, IOBase=%p\n", + _DBG_PRINTF ("NEWGAL>FBCON>SMI: DPR=%p, VPR=%p, IOBase=%p\n", pSmi->DPRBase, pSmi->VPRBase, pSmi->IOBase); - _MG_PRINTF ("NEWGAL>FBCON>SMI: DataPort=%p - %p\n", pSmi->DataPortBase, + _DBG_PRINTF ("NEWGAL>FBCON>SMI: DataPort=%p - %p\n", pSmi->DataPortBase, pSmi->DataPortBase + pSmi->DataPortSize - 1); pSmi->memPhysBase = PCI_REGION_BASE(pSmi->PciInfo, 0, REGION_MEM); @@ -262,7 +262,7 @@ static BOOL SMI_MapMem (_THIS) pSmi->videoRAMBytes = pSmi->videoRAMKBytes * 1024; - _MG_PRINTF ("NEWGAL>FBCON>SMI: videoram: %dkB\n", pSmi->videoRAMKBytes); + _DBG_PRINTF ("NEWGAL>FBCON>SMI: videoram: %dkB\n", pSmi->videoRAMKBytes); if (pSmi->videoRAMBytes) { /* Map the frame buffer */ @@ -286,20 +286,20 @@ static BOOL SMI_MapMem (_THIS) if (err) { perror ("pci_device_map_range"); - _MG_PRINTF ("NEWGAL>FBCON>SMI: pci_device_map_range failure.\n"); + _WRN_PRINTF ("NEWGAL>FBCON>SMI: pci_device_map_range failure.\n"); return FALSE; } } if (pSmi->FBBase == NULL) { - _MG_PRINTF ("NEWGAL>FBCON>SMI: Internal error: could not " + _WRN_PRINTF ("NEWGAL>FBCON>SMI: Internal error: could not " "map framebuffer.\n"); return FALSE; } - _MG_PRINTF ("NEWGAL>FBCON>SMI: Physical frame buffer at 0x%08lX offset: 0x%08lX\n", + _DBG_PRINTF ("NEWGAL>FBCON>SMI: Physical frame buffer at 0x%08lX offset: 0x%08lX\n", pSmi->memPhysBase, pSmi->fbOffset); - _MG_PRINTF ("NEWGAL>FBCON>SMI: Logical frame buffer at %p - %p\n", pSmi->FBBase, + _DBG_PRINTF ("NEWGAL>FBCON>SMI: Logical frame buffer at %p - %p\n", pSmi->FBBase, pSmi->FBBase + pSmi->videoRAMBytes - 1); /* Set up offset to hwcursor memory area. It's a 1K chunk at the end of @@ -307,7 +307,7 @@ static BOOL SMI_MapMem (_THIS) */ pSmi->FBCursorOffset = pSmi->videoRAMBytes - 1024; - _MG_PRINTF ("NEWGAL>FBCON>SMI: Cursor Offset: %08lX\n", + _DBG_PRINTF ("NEWGAL>FBCON>SMI: Cursor Offset: %08lX\n", (unsigned long)pSmi->FBCursorOffset); /* set up the fifo reserved space */ @@ -323,7 +323,7 @@ static BOOL SMI_MapMem (_THIS) pSmi->FBReserved = pSmi->videoRAMBytes - 2048; } - _MG_PRINTF ("NEWGAL>FBCON>SMI: Reserved: %08lX\n", + _DBG_PRINTF ("NEWGAL>FBCON>SMI: Reserved: %08lX\n", (unsigned long)pSmi->FBReserved); } @@ -382,7 +382,7 @@ static void SMI_GEReset (int from_timeout, int line, char *file) if (from_timeout) { if (pSmi->GEResetCnt++ < 10) { - _MG_PRINTF ("\tSMI_GEReset called from %s line %d\n", file, line); + _DBG_PRINTF ("\tSMI_GEReset called from %s line %d\n", file, line); } } else { @@ -478,7 +478,7 @@ static void SMI_SetClippingRectangle (int left, int top, int right, int bottom) SMIPtr pSmi = &smi_rec; ENTER_PROC("SMI_SetClippingRectangle"); - _MG_PRINTF ("left=%d top=%d right=%d bottom=%d\n", left, top, right, bottom); + _DBG_PRINTF ("left=%d top=%d right=%d bottom=%d\n", left, top, right, bottom); /* CZ 26.10.2001: this code prevents offscreen pixmaps being drawn ??? left = max(left, 0); @@ -642,7 +642,7 @@ static void SMI_SetupForScreenToScreenCopy (int xdir, int ydir, int rop, { SMIPtr pSmi = &smi_rec; - _MG_PRINTF ("xdir=%d ydir=%d rop=%02X trans=%08X\n", xdir, ydir, rop, trans); + _DBG_PRINTF ("xdir=%d ydir=%d rop=%02X trans=%08X\n", xdir, ydir, rop, trans); pSmi->AccelCmd = SMI_BltRop [rop] | SMI_BITBLT @@ -670,7 +670,7 @@ static void SMI_SubsequentScreenToScreenCopy (int x1, int y1, int x2, { SMIPtr pSmi = &smi_rec; - _MG_PRINTF ("x1=%d y1=%d x2=%d y2=%d w=%d h=%d\n", x1, y1, x2, y2, w, h); + _DBG_PRINTF ("x1=%d y1=%d x2=%d y2=%d w=%d h=%d\n", x1, y1, x2, y2, w, h); if (pSmi->AccelCmd & SMI_RIGHT_TO_LEFT) { x1 += w - 1; @@ -913,7 +913,7 @@ int SMI_Probe (_THIS, const struct fb_fix_screeninfo* fb_finfo, PCI_VIDEO_DRIVER iter = pci_id_match_iterator_create (&id_match); while ((dev = pci_device_next (iter)) != NULL) { - _MG_PRINTF ("NEWGAL>FBCON>SMI: found PCI video device by SMI: 0x%x (0x%x, 0x%x)\n", + _DBG_PRINTF ("NEWGAL>FBCON>SMI: found PCI video device by SMI: 0x%x (0x%x, 0x%x)\n", dev->device_id, dev->subvendor_id, dev->subdevice_id); int i = 0; @@ -932,7 +932,7 @@ found: if (dev) { SMIPtr pSmi = &smi_rec; - _MG_PRINTF ("NEWGAL>FBCON>SMI: found SMI chipset: %d, %s (id of fb is %s)\n", + _DBG_PRINTF ("NEWGAL>FBCON>SMI: found SMI chipset: %d, %s (id of fb is %s)\n", SMIChipsets [num_chipset].token, SMIChipsets [num_chipset].name, fb_finfo->id); @@ -947,7 +947,7 @@ found: pci_device_probe (dev); } else { - _MG_PRINTF ("NEWGAL>FBCON>SMI: not found any SMI chipset.\n"); + _DBG_PRINTF ("NEWGAL>FBCON>SMI: not found any SMI chipset.\n"); } pci_iterator_destroy (iter); diff --git a/src/newgal/fbcon/pci_smi.h b/src/newgal/fbcon/pci_smi.h index f524408a..1585c976 100644 --- a/src/newgal/fbcon/pci_smi.h +++ b/src/newgal/fbcon/pci_smi.h @@ -44,11 +44,11 @@ /******************************************************************************/ #ifdef _DEBUG -# define ENTER_PROC(PROCNAME) _MG_PRINTF ("ENTER\t" PROCNAME \ +# define ENTER_PROC(PROCNAME) _WRN_PRINTF ("ENTER\t" PROCNAME \ "(%d)\n", __LINE__) -# define DEBUG_PROC(PROCNAME) _MG_PRINTF ("DEBUG\t" PROCNAME \ +# define DEBUG_PROC(PROCNAME) _WRN_PRINTF ("DEBUG\t" PROCNAME \ "(%d)\n", __LINE__) -# define LEAVE_PROC(PROCNAME) _MG_PRINTF ("LEAVE\t" PROCNAME \ +# define LEAVE_PROC(PROCNAME) _WRN_PRINTF ("LEAVE\t" PROCNAME \ "(%d)\n", __LINE__) #else # define ENTER_PROC(PROCNAME) diff --git a/src/newgal/fbcon/pcivideo.c b/src/newgal/fbcon/pcivideo.c index 258e389c..edc9f242 100644 --- a/src/newgal/fbcon/pcivideo.c +++ b/src/newgal/fbcon/pcivideo.c @@ -63,7 +63,7 @@ int FB_ProbePCIAccelDriver (_THIS, const struct fb_fix_screeninfo* fb_finfo) int ret; if (pci_system_init ()) { - _MG_PRINTF ("NEWGAL>FBCON: Couldn't initialize PCI system\n"); + _WRN_PRINTF ("NEWGAL>FBCON: Couldn't initialize PCI system\n"); return -1; } diff --git a/src/newgal/pcxvfb/pcxvfb.c b/src/newgal/pcxvfb/pcxvfb.c index 17e790e5..dd05137d 100644 --- a/src/newgal/pcxvfb/pcxvfb.c +++ b/src/newgal/pcxvfb/pcxvfb.c @@ -425,11 +425,11 @@ static int PCXVFB_VideoInit (_THIS, GAL_PixelFormat *vformat) //shm_init_lock(getpid()); if ((pid = fork()) < 0) { - _MG_PRINTF ("NEWGAL>PCXVFB: fork() error.\n"); + _WRN_PRINTF ("NEWGAL>PCXVFB: fork() error.\n"); } else if (pid == 0) { if (execl_pcxvfb() == ERR_CONFIG_FILE) - _MG_PRINTF ("NEWGAL>PCXVFB: failed to read configuration failure.\n"); + _WRN_PRINTF ("NEWGAL>PCXVFB: failed to read configuration failure.\n"); perror ("execl"); _exit (1); diff --git a/src/newgdi/drawtext.c b/src/newgdi/drawtext.c index 02cffbbd..17f5cc5b 100644 --- a/src/newgdi/drawtext.c +++ b/src/newgdi/drawtext.c @@ -236,7 +236,7 @@ int DrawTextEx2 (HDC hdc, const char* pText, int nCount, /* If output rect is too small, we shouldn't output any text.*/ if (RECTW(rcDraw) < pdc->pLogFont->size && RECTH(rcDraw) < pdc->pLogFont->size) { - _MG_PRINTF ("NEWGDI: " + _WRN_PRINTF ("NEWGDI: " "Output rect is too small, we won't output any text. \n"); return -1; } diff --git a/src/newgdi/gdi.c b/src/newgdi/gdi.c index 4ca4c8cc..c7471e9c 100644 --- a/src/newgdi/gdi.c +++ b/src/newgdi/gdi.c @@ -221,7 +221,7 @@ void mg_TerminateScreenDC (void) #define INIT_SPECIFICAL_FONTS(etc_section) \ { \ if (!font_InitSpecificalFonts (etc_section)) { \ - _MG_PRINTF ("NEWGDI>InitGDI: Can not initialize fonts defined in section %s!\n", etc_section); \ + _WRN_PRINTF ("NEWGDI>InitGDI: Can not initialize fonts defined in section %s!\n", etc_section); \ goto error; \ } \ } @@ -230,7 +230,7 @@ void mg_TerminateScreenDC (void) BOOL mg_InitGDI (void) { if (!InitTextBitmapBuffer ()) { - _MG_PRINTF ("NEWGDI>InitGDI: Can not initialize text bitmap buffer!\n"); + _WRN_PRINTF ("NEWGDI>InitGDI: Can not initialize text bitmap buffer!\n"); goto error; } @@ -252,7 +252,7 @@ BOOL mg_InitGDI (void) #if (defined (_MGFONT_TTF) || defined (_MGFONT_FT2)) && defined(_MGRM_THREADS) if (!font_InitFreetypeLibrary ()) { - _MG_PRINTF ("NEWGDI>InitGDI: Can not initialize freetype fonts!\n"); + _WRN_PRINTF ("NEWGDI>InitGDI: Can not initialize freetype fonts!\n"); goto error; } INIT_SPECIFICAL_FONTS (FONT_ETC_SECTION_NAME_TTF); @@ -261,13 +261,13 @@ BOOL mg_InitGDI (void) /* TODO: add other font support here */ #if defined (_MGFONT_SEF) && !defined(_LITE_VERSION) if(!initialize_scripteasy()) { - _MG_PRINTF ("NEWGDI>InitGDI: Can not initialize ScriptEasy fonts!\n"); + _WRN_PRINTF ("NEWGDI>InitGDI: Can not initialize ScriptEasy fonts!\n"); goto error; } #endif if (!font_InitIncoreFonts ()) { - _MG_PRINTF ("NEWGDI>InitGDI: Can not initialize incore fonts!\n"); + _WRN_PRINTF ("NEWGDI>InitGDI: Can not initialize incore fonts!\n"); goto error; } @@ -276,7 +276,7 @@ BOOL mg_InitGDI (void) #endif if (!mg_InitSysFont ()) { - _MG_PRINTF ("NEWGDI>InitGDI: Can not create system fonts!\n"); + _WRN_PRINTF ("NEWGDI>InitGDI: Can not create system fonts!\n"); goto error; } @@ -2647,7 +2647,7 @@ HDC GetSecondarySubDC (HDC secondary_dc, HWND hwnd_child, BOOL client) UNLOCK(&dcslot); if (i >= DCSLOTNUMBER) { - _MG_PRINTF ("NEWGDI>GetSecondarySubDC: no DC slot.\n"); + _WRN_PRINTF ("NEWGDI>GetSecondarySubDC: no DC slot.\n"); return HDC_SCREEN; } @@ -3392,7 +3392,7 @@ HDC GUIAPI InitSlaveScreenEx (const char* name, const char* mode, int dpi) } else { free (pmem_dc); - _MG_PRINTF ("NEWGDI>InitSlaveScreen: Can not init the slave screen: %s (%s)\n", + _WRN_PRINTF ("NEWGDI>InitSlaveScreen: Can not init the slave screen: %s (%s)\n", name, mode); return HDC_INVALID; } diff --git a/src/newgdi/glyph.c b/src/newgdi/glyph.c index 1280492c..c1f141da 100644 --- a/src/newgdi/glyph.c +++ b/src/newgdi/glyph.c @@ -2465,7 +2465,7 @@ static void draw_back_area (PDC pdc, POINT* area, GAL_Rect* gal_rc, break; default: - _MG_PRINTF ("NEWGDI>Glyph: NO WAY\n"); + _WRN_PRINTF ("NEWGDI>Glyph: NO WAY\n"); break; } } @@ -2635,7 +2635,7 @@ static void draw_glyph_lines (PDC pdc, int x1, int y1, int x2, int y2) _dc_set_pixel_noclip); } else - _MG_PRINTF ("NEWGDI>Glyph: no under line, rc_output: %d, %d, %d, %d\n", + _WRN_PRINTF ("NEWGDI>Glyph: no under line, rc_output: %d, %d, %d, %d\n", pdc->rc_output.left, pdc->rc_output.top, pdc->rc_output.right, pdc->rc_output.bottom); cliprect = cliprect->next; diff --git a/src/newgdi/layout-utils.c b/src/newgdi/layout-utils.c index ea277304..31598b50 100644 --- a/src/newgdi/layout-utils.c +++ b/src/newgdi/layout-utils.c @@ -42,8 +42,6 @@ #include #include -#define DEBUG - #include "common.h" #ifdef _MGCHARSET_UNICODE diff --git a/src/newgdi/layoutinfo.c b/src/newgdi/layoutinfo.c index 4c7c67c8..8ad6331c 100644 --- a/src/newgdi/layoutinfo.c +++ b/src/newgdi/layoutinfo.c @@ -65,8 +65,6 @@ #include #include -#define DEBUG - #include "common.h" #ifdef _MGCHARSET_UNICODE @@ -150,6 +148,13 @@ typedef enum { BREAK_LINE_SEPARATOR } BreakResult; +/* Local array size, used for stack-based local arrays */ +#if SIZEOF_PTR == 8 +# define LOCAL_ARRAY_SIZE 256 +#else +# define LOCAL_ARRAY_SIZE 128 +#endif + struct _LayoutState { /* maintained per layout */ // is last line @@ -171,6 +176,9 @@ struct _LayoutState { // to the remaining portion of the first lrun int log_widths_offset; + // Local array for logical widths + int local_log_widths[LOCAL_ARRAY_SIZE]; + // Character offset of first lrun in state->lrun in layout->truninfo->ucs int start_offset; @@ -190,6 +198,24 @@ struct _LayoutState { int remaining_width; }; +static inline void state_log_widths_new(LayoutState* state, int n) +{ + if (n <= LOCAL_ARRAY_SIZE) { + state->log_widths = state->local_log_widths; + return; + } + + state->log_widths = malloc(sizeof(int) * n); +} + +static inline void state_log_widths_free(LayoutState* state) +{ + if (state->log_widths && state->log_widths != state->local_log_widths) + free(state->log_widths); + + state->log_widths = NULL; +} + static BOOL should_ellipsize_current_line(LAYOUTINFO *layout, LayoutState *state) { @@ -466,7 +492,7 @@ static void free_glyph_run (GlyphRun *grun) free(grun); } -#ifdef DEBUG +#ifdef _DEBUG static inline void print_text_runs(const TEXTRUNSINFO* info, const char* func) { int j = 0; @@ -582,8 +608,7 @@ static GlyphRun* insert_run(LAYOUTLINE *line, LayoutState *state, if (state->log_widths_offset > 0) __mg_glyph_string_free(state->glyphs); state->glyphs = NULL; - free(state->log_widths); - state->log_widths = NULL; + state_log_widths_free(state); } list_add_tail(&glyph_run->list, &line->gruns); @@ -714,7 +739,7 @@ BreakResult process_layout_run(LAYOUTINFO *layout, glyph_run.gstr = state->glyphs; assert(state->log_widths == NULL); - state->log_widths = malloc (sizeof (int) * lrun->len); + state_log_widths_new(state, lrun->len); __mg_glyph_run_get_logical_widths(&glyph_run, layout->truninfo->ucs, state->log_widths); } @@ -802,10 +827,9 @@ retry_break: } } else { - __mg_glyph_string_free (state->glyphs); + __mg_glyph_string_free(state->glyphs); state->glyphs = NULL; - free (state->log_widths); - state->log_widths = NULL; + state_log_widths_free(state); return BREAK_NONE_FIT; } @@ -973,13 +997,6 @@ static inline void list_reverse(struct list_head* head) list_move(head, &tmp_head); } -/* Local array size, used for stack-based local arrays */ -#if SIZEOF_PTR == 8 -# define LOCAL_ARRAY_SIZE 256 -#else -# define LOCAL_ARRAY_SIZE 128 -#endif - static void layout_line_reorder(LAYOUTLINE *line) { struct list_head *i; @@ -1673,6 +1690,12 @@ LAYOUTLINE* GUIAPI LayoutNextLine( LAYOUTLINE* next_line = NULL; LayoutState state; + if (prev_line && prev_line->list.next && + prev_line->list.next != &layout->lines) { + // must be a line persisted and not the last line. + return (LAYOUTLINE*)prev_line->list.next; + } + if (layout->persist && layout->nr_left_ucs == 0) { // already laid out @@ -1742,27 +1765,31 @@ LAYOUTLINE* GUIAPI LayoutNextLine( __mg_glyph_string_free(state.glyphs); } if (state.log_widths) { - free(state.log_widths); + state_log_widths_free(&state); } if (next_line) { if (layout->persist) { list_add_tail(&next_line->list, &layout->lines); } + else { + // list->next == NULL for not persisted. + next_line->list.next = NULL; + } layout->nr_lines++; layout->nr_left_ucs -= next_line->len; } - // Release previous line after got next line. + // Release the previous line after got the next line. // This will avoid releasing the LOGFONT objects earlier. - if (prev_line) { + if (layout->persist == 0 && prev_line) { release_line(prev_line); prev_line = NULL; } out: - if (prev_line) { + if (layout->persist == 0 && prev_line) { release_line(prev_line); } diff --git a/src/newgdi/polygon.c b/src/newgdi/polygon.c index e30f0035..a3c63a74 100644 --- a/src/newgdi/polygon.c +++ b/src/newgdi/polygon.c @@ -587,7 +587,7 @@ BOOL GUIAPI PolygonGeneratorEx (void* context, const POINT* pts, int vertices, /* if rc_output not NULL, the scanlines's range is * limit in the RECT. */ if(rc_output){ - _MG_PRINTF("rc_output:(%d,%d)\n", rc_output->top, rc_output->bottom); + _DBG_PRINTF("rc_output:(%d,%d)\n", rc_output->top, rc_output->bottom); edge = inactive_edges; while ((edge)) { next_edge = edge->next; @@ -601,14 +601,14 @@ BOOL GUIAPI PolygonGeneratorEx (void* context, const POINT* pts, int vertices, #else Int64AddInt32(&(edge->x), edge->dx * (rc_output->top - edge->top), &(edge->x)); #endif - _MG_PRINTF("start check newly active edes c=%d,top=%d," + _DBG_PRINTF("start check newly active edes c=%d,top=%d," "bottom=%d.\n", c, edge->top, edge->bottom); } /* add the edge outside the rc_ouput. */ else if(edge->bottom < rc_output->top || edge->top > rc_output->bottom){ inactive_edges = _remove_edge(inactive_edges, edge); - _MG_PRINTF("start delete edes c=%d,top=%d," + _DBG_PRINTF("start delete edes c=%d,top=%d," "bottom=%d.\n", c, edge->top, edge->bottom); } edge = next_edge; @@ -628,7 +628,7 @@ BOOL GUIAPI PolygonGeneratorEx (void* context, const POINT* pts, int vertices, next_edge = edge->next; inactive_edges = _remove_edge(inactive_edges, edge); active_edges = _add_edge(active_edges, edge, TRUE); - _MG_PRINTF("check newly active edes c=%d,top=%d," + _DBG_PRINTF("check newly active edes c=%d,top=%d," "bottom=%d.\n", c, edge->top, edge->bottom); edge = next_edge; } @@ -656,7 +656,7 @@ BOOL GUIAPI PolygonGeneratorEx (void* context, const POINT* pts, int vertices, next_edge = edge->next; if (c >= edge->bottom) { active_edges = _remove_edge(active_edges, edge); - _MG_PRINTF("delete edes c=%d,top=%d," + _DBG_PRINTF("delete edes c=%d,top=%d," "bottom=%d.\n", c, edge->top, edge->bottom); } else { diff --git a/src/server/client.c b/src/server/client.c index 560cd64e..647a046d 100644 --- a/src/server/client.c +++ b/src/server/client.c @@ -166,7 +166,7 @@ void __mg_client_del (int cli) MG_Client* deleting = mgClients + cli; MG_Layer* layer = deleting->layer; - _MG_PRINTF ("SERVER: Remove a client: %s\n", deleting->name); + _WRN_PRINTF ("SERVER: Remove a client: %s\n", deleting->name); if (layer == NULL) goto ret; diff --git a/src/server/layer.c b/src/server/layer.c index 5b942b6e..8ddac9c5 100644 --- a/src/server/layer.c +++ b/src/server/layer.c @@ -182,12 +182,12 @@ BOOL GUIAPI ServerDeleteLayer (MG_Layer* layer) MG_Client* client; if (layer == NULL || strcmp (layer->name, NAME_DEF_LAYER) == 0) { - _MG_PRINTF ("SERVER: Can not delete the default layer.\n"); + _WRN_PRINTF ("SERVER: Can not delete the default layer.\n"); return FALSE; } if (zi->nr_topmosts + zi->nr_normals + zi->nr_popupmenus != 0) { - _MG_PRINTF ("SERVER: Some objects are still in this layer.\n"); + _WRN_PRINTF ("SERVER: Some objects are still in this layer.\n"); return FALSE; } @@ -318,7 +318,7 @@ static MG_Layer* alloc_layer (const char* layer_name, return NULL; } - _MG_PRINTF ("SERVER: Create a new layer: %s\n", layer_name); + _WRN_PRINTF ("SERVER: Create a new layer: %s\n", layer_name); strcpy (new_layer->name, layer_name); new_layer->cli_head = NULL; @@ -337,14 +337,14 @@ static MG_Layer* alloc_layer (const char* layer_name, mgTopmostLayer = new_layer; - _MG_PRINTF ("SERVER: alloc_layer, mgTopmostLayer->zi = %p\n", + _WRN_PRINTF ("SERVER: alloc_layer, mgTopmostLayer->zi = %p\n", mgTopmostLayer->zorder_info); /* Topmost layer changed */ CHANGE_TOPMOST_LAYER(mgTopmostLayer); __mg_do_change_topmost_layer (); - _MG_PRINTF ("SERVER: alloc_layer, mgTopmostLayer->zi = %p\n", + _WRN_PRINTF ("SERVER: alloc_layer, mgTopmostLayer->zi = %p\n", mgTopmostLayer->zorder_info); /* Notify that a new topmost layer have been set. */ @@ -421,7 +421,7 @@ static void do_client_join_layer (int cli, return; } - _MG_PRINTF ("SERVER: Join a client (%s) to layer %s\n", + _WRN_PRINTF ("SERVER: Join a client (%s) to layer %s\n", info->client_name, layer->name); strcpy (new_client->name, info->client_name); diff --git a/src/sysres/resource.c b/src/sysres/resource.c index 01c610b2..39dfe36c 100644 --- a/src/sysres/resource.c +++ b/src/sysres/resource.c @@ -63,7 +63,7 @@ BOOL GUIAPI RegisterResFromFile (HDC hdc, const char* file) { if (!file) { - _MG_PRINTF ("SYSRES>RegisterResFromFile: file is NULL\n"); + _WRN_PRINTF ("SYSRES>RegisterResFromFile: file is NULL\n"); return FALSE; } @@ -76,7 +76,7 @@ RegisterResFromMem (HDC hdc, const char* file, const unsigned char* data, { if (!data || !file) { - _MG_PRINTF ("SYSRES>RegisterResFromMem: file or data is NULL\n"); + _WRN_PRINTF ("SYSRES>RegisterResFromMem: file or data is NULL\n"); return FALSE; } @@ -100,7 +100,7 @@ BOOL GUIAPI RegisterResFromBitmap (const char* file, const BITMAP* bmp) { if (!bmp || !file) { - _MG_PRINTF ("SYSRES>RegisterResFromBitmap: file or bitmap is NULL\n"); + _WRN_PRINTF ("SYSRES>RegisterResFromBitmap: file or bitmap is NULL\n"); return FALSE; } @@ -164,7 +164,7 @@ HICON GUIAPI LoadSystemIconEx (HDC hdc, const char* rdr_name, if (GetMgEtcValue (rdr->name, szItemName, iconname, sizeof(szValue)-(iconname-szValue)) < 0 ) { - _MG_PRINTF ("SYSRES: can't get %s's value from section %s in etc.\n", + _WRN_PRINTF ("SYSRES: can't get %s's value from section %s in etc.\n", szItemName, rdr->name); return 0; } @@ -198,7 +198,7 @@ BOOL InitRendererSystemIcon (const char* rdr_name, */ if (GetMgEtcValue (rdr_name, "iconnumber", szValue, 10) < 0) { - _MG_PRINTF ("SYSRES: can't get icon number for LFRDR %s.\n", rdr_name); + _WRN_PRINTF ("SYSRES: can't get icon number for LFRDR %s.\n", rdr_name); return FALSE; } @@ -261,7 +261,7 @@ GetSystemBitmapEx (const char* rdr_name, const char* id) char *filename = file + strlen(file); if (GetMgEtcValue (rdr_name, id, filename, sizeof(file)-(filename-file)) < 0 ) { - _MG_PRINTF ("SYSRES: Can't get bitmap file name for LFRDR %s: %s!\n", + _WRN_PRINTF ("SYSRES: Can't get bitmap file name for LFRDR %s: %s!\n", rdr_name, id); return NULL; }