diff --git a/dvi_init.cpp b/dvi_init.cpp index 682e99f5b..f25110952 100644 --- a/dvi_init.cpp +++ b/dvi_init.cpp @@ -106,7 +106,7 @@ static long last_page_offset; extern void reset_fonts(void) { - kDebugInfo(DEBUG, 4300, "Reset Fonts"); + kdDebug() << "Reset Fonts" << endl; struct font *f; struct glyph *g; @@ -164,7 +164,7 @@ font *define_font(FILE *file, unsigned int cmnd, font *vfparent, QIntDictfontname); + kdError() << " in virtual font " << currinf._virtual->fontname << endl; else - kDebugError(", offset %ld", xtell(currinf.pos - 1)); + kdError() << ", offset " << xtell(currinf.pos - 1) << "d" << endl; dvi_oops_msg = (message), longjmp(dvi_env, 1); /* dvi_oops */ exit(1); } @@ -248,7 +248,7 @@ static void change_font(unsigned long n) void set_char(unsigned int cmd, unsigned int ch) { - kDebugInfo(DEBUG, 4300, "set_char"); + kdDebug() << "set_char" << endl; glyph *g = currinf.fontp->glyphptr(ch); if (g == NULL) @@ -275,10 +275,10 @@ static void set_empty_char(unsigned int cmd, unsigned int ch) void load_n_set_char(unsigned int cmd, unsigned int ch) { - kDebugInfo(DEBUG, 4300, "load_n_set_char"); + kdDebug() << "load_n_set_char" << endl; if ( currinf.fontp->load_font() ) { /* if not found */ - kDebugError("Character(s) will be left blank."); + kdError() << "Character(s) will be left blank." << endl; currinf.set_char_p = currinf.fontp->set_char_p = set_empty_char; return; } @@ -290,7 +290,7 @@ void load_n_set_char(unsigned int cmd, unsigned int ch) void set_vf_char(unsigned int cmd, unsigned int ch) { - kDebugInfo(DEBUG, 4300, "set_vf_char"); + kdDebug() << "set_vf_char" << endl; macro *m; struct drawinf oldinfo; @@ -299,7 +299,7 @@ void set_vf_char(unsigned int cmd, unsigned int ch) if ((m = &currinf.fontp->macrotable[ch])->pos == NULL) { if (!hush_chars) - kDebugError(1, 4300, "Character %d not defined in font %s\n", ch, currinf.fontp->fontname); + kdError() << "Character " << ch << " not defined in font" << currinf.fontp->fontname << endl; m->pos = m->end = &c; return; } @@ -333,7 +333,7 @@ void set_vf_char(unsigned int cmd, unsigned int ch) static void set_no_char(unsigned int cmd, unsigned int ch) { - kDebugInfo(DEBUG, 4300, "set_no_char"); + kdDebug() << "set_no_char" << endl; if (currinf._virtual) { currinf.fontp = currinf._virtual->first_font; @@ -391,7 +391,7 @@ static void special(long nbytes) static void draw_part(struct frame *minframe, double current_dimconv) { - kDebugInfo(DEBUG, 4300, "draw_part"); + kdDebug() << "draw_part" << endl; unsigned char ch; struct drawinf oldinfo; @@ -642,7 +642,7 @@ int need_to_redraw; void draw_page() { - kDebugInfo(DEBUG, 4300, "draw_page"); + kdDebug() <<"draw_page" << endl; need_to_redraw = 0; diff --git a/font.cpp b/font.cpp index 383f6571f..0165e31bb 100644 --- a/font.cpp +++ b/font.cpp @@ -61,7 +61,7 @@ extern int n_files_left; font::font(char *nfontname, float nfsize, long chk, int mag, double dconv) { - kDebugInfo(DEBUG, 4300, "constructing font %s at %d dpi", nfontname, (int) (nfsize + 0.5)); + kdDebug() << "constructing font " << nfontname << " at " << (int) (nfsize + 0.5) << " dpi" << endl; fontname = nfontname; fsize = nfsize; @@ -75,7 +75,7 @@ font::font(char *nfontname, float nfsize, long chk, int mag, double dconv) font::~font() { - kDebugInfo(DEBUG, 4300, "discarding font \"%s\" at %d dpi",fontname,(int)(fsize + 0.5)); + kdDebug() << "discarding font " << fontname << " at " << (int)(fsize + 0.5) << " dpi" << endl; free(fontname); @@ -117,7 +117,7 @@ font::~font() unsigned char font::load_font(void) { - kDebugInfo(DEBUG, 4300, "loading font %s at %d dpi", fontname, (int) (fsize + 0.5)); + kdDebug() << "loading font " << fontname << " at " << (int) (fsize + 0.5) << " dpi" << endl; int dpi = (int)(fsize + 0.5); char *font_found; @@ -129,19 +129,19 @@ unsigned char font::load_font(void) flags |= font::FONT_LOADED; file = font_open(fontname, &font_found, (double)fsize, &size_found, &filename); if (file == NULL) { - kDebugError("Can't find font %s.", fontname); + kdError() << "Can't find font " << fontname << "." << endl; return True; } --n_files_left; if (font_found != NULL) { - kDebugError("Can't find font %s; using %s instead at %d dpi.", fontname, font_found, dpi); + kdError() << "Can't find font " << fontname << "; using " << font_found << " instead at " << dpi << " dpi." << endl; free(fontname); fontname = font_found; hushcs = True; } else if (!kpse_bitmap_tolerance ((double) size_found, fsize)) - kDebugError("Can't find font %s at %d dpi; using %d dpi instead.", fontname, dpi, size_found); + kdError() << "Can't find font " << fontname << " at " << dpi << " dpi; using " << size_found << " dpi instead." << endl; fsize = size_found; timestamp = ++current_timestamp; set_char_p = set_char; @@ -171,7 +171,7 @@ void font::mark_as_used(void) if (flags & font::FONT_IN_USE) return; - kDebugInfo(DEBUG, 4300, "marking font %s at %d dpi as used", fontname, (int) (fsize + 0.5)); + kdDebug() << "marking font " << fontname << " at " << (int) (fsize + 0.5) << " dpi" << endl; flags |= font::FONT_IN_USE; @@ -194,7 +194,7 @@ struct glyph *font::glyphptr(unsigned int ch) { struct glyph *g = glyphtable+ch; if (g->bitmap.bits == NULL) { if (g->addr == 0) { - kDebugError(1,4300,"Character %d not defined in font %s", ch, fontname); + kdError() << "Character " << ch << " not defined in font " << fontname << endl; g->addr = -1; return NULL; } diff --git a/pk.cpp b/pk.cpp index ddd3bd7bb..8b9fe874d 100644 --- a/pk.cpp +++ b/pk.cpp @@ -49,7 +49,6 @@ * and Luis Miguel Silveira, MIT RLE. */ -#define DEBUG 0 #include @@ -85,7 +84,7 @@ static int PK_repeat_count; int font::PK_get_nyb(FILE *fp) { - kDebugInfo(DEBUG, 4300, "PK_get_nyb"); + kdDebug() << "PK_get_nyb" << endl; unsigned temp; if (PK_bitpos < 0) { @@ -100,7 +99,7 @@ int font::PK_get_nyb(FILE *fp) int font::PK_packed_num(FILE *fp) { - kDebugInfo(DEBUG, 4300, "PK_packed_num"); + kdDebug() << "PK_packed_num" << endl; int i,j; @@ -130,7 +129,7 @@ int font::PK_packed_num(FILE *fp) void font::PK_skip_specials(void) { - kDebugInfo(DEBUG, 4300, "PK_skip_specials"); + kdDebug() << "PK_skip_specials" << endl; int i,j; register FILE *fp = file; @@ -169,7 +168,7 @@ void font::PK_skip_specials(void) void font::read_PK_char(unsigned int ch) { - kDebugInfo(DEBUG, 4300, "read_PK_char"); + kdDebug() << "read_PK_char" << endl; int i, j; int n; @@ -196,7 +195,7 @@ void font::read_PK_char(unsigned int ch) else n = 1; - kDebugInfo(DEBUG, 4300, "loading pk char %d, char type %d ", ch, n); + kdDebug() << "loading pk char " << ch << ", char type " << n << endl; /* * now read rest of character preamble @@ -223,9 +222,6 @@ void font::read_PK_char(unsigned int ch) g->dvi_adv = (int)(dimconv * fpwidth + 0.5); - if (DEBUG && g->bitmap.w != 0) - kDebugInfo(DEBUG, 4300, ", size=%dx%d, dvi_adv=%ld", g->bitmap.w, g->bitmap.h, g->dvi_adv); - alloc_bitmap(&g->bitmap); cp = (BMUNIT *) g->bitmap.bits; @@ -333,19 +329,18 @@ void font::read_PK_char(unsigned int ch) void font::read_PK_index(unsigned int hushcs) { - kDebugInfo(DEBUG, 4300, "Reading PK pixel file %s", filename); + kdDebug() << "Reading PK pixel file " << filename << endl; Fseek(file, (long) one(file), 1); /* skip comment */ (void) four(file); /* skip design size */ long file_checksum = four(file); if (!hushcs && checksum && checksum && file_checksum != checksum) - kDebugError(1, 4300, "Checksum mismatch (dvi = %lu, pk = %lu) in font file %s", - checksum, file_checksum, filename); + kdError(1) << "Checksum mismatch (dvi = " << checksum << "pk = " << file_checksum << ") in font file " << filename << endl; int hppp = sfour(file); int vppp = sfour(file); - if (DEBUG && hppp != vppp) - kDebugInfo(DEBUG, 4300, "Font has non-square aspect ratio %d:%d", vppp, hppp); + if (hppp != vppp) + kdDebug() << "Font has non-square aspect ratio " << vppp << ":" << hppp << endl; /* * Prepare glyph array. */ @@ -376,6 +371,6 @@ void font::read_PK_index(unsigned int hushcs) glyphtable[ch].addr = ftell(file); glyphtable[ch].x2 = PK_flag_byte; Fseek(file, (long) bytes_left, 1); - kDebugInfo(DEBUG, 4300, "Scanning pk char %u, at %ld.", ch, glyphtable[ch].addr); + kdDebug() << "Scanning pk char " << ch << "at " << glyphtable[ch].addr << endl; } } diff --git a/print.cpp b/print.cpp index 85991c101..f1344d5b2 100644 --- a/print.cpp +++ b/print.cpp @@ -270,7 +270,7 @@ void Print::okPressed() cmd += " &"; - kDebugInfo( 4300,"About to run: %s", cmd.data()); + kdDebug(4300) << "About to run: " << cmd.data() << endl; system( cmd ); accept(); } diff --git a/special.cpp b/special.cpp index 4c64efe6a..9023747d9 100644 --- a/special.cpp +++ b/special.cpp @@ -55,8 +55,6 @@ * it's worth it. */ -#define DEBUG 1 - #include #include "dviwin.h" @@ -681,7 +679,7 @@ static void epsf_special(char *cp) double keyval[6]; if (memcmp(cp, "ile=", 4) != 0) { - kDebugError(1, 4300, "epsf special PSf%s is unknown", cp); + kdError(1) << "epsf special PSf" << cp << " is unknown" << endl; return; } @@ -718,7 +716,7 @@ static void epsf_special(char *cp) ++p1; for (keyno = 0;; ++keyno) { if (keyno >= NKEYS) { - kDebugError(4300, 1, "unknown keyword (%*s) in \\special will be ignored\n", (int) (p1 - p), p); + kdError(4300) << "unknown keyword in \\special will be ignored" << endl; break; } if (memcmp(p, keytab[keyno], p1 - p) == 0) { @@ -772,7 +770,6 @@ static void epsf_special(char *cp) static void bang_special(char *cp) { - // kDebugInfo(DEBUG, 4300, "bang %s", cp); bbox_valid = False; if (currwin.win == mane.win) { diff --git a/util.cpp b/util.cpp index fbd9fcbd5..22c10411c 100644 --- a/util.cpp +++ b/util.cpp @@ -115,7 +115,7 @@ oops(va_alist) char * xmalloc(unsigned size, _Xconst char *why) { - kDebugInfo(DEBUG, 4300, "Allocating %d bytes for %s", size, why); + kdDebug() << "Allocating " << size << " bytes for " << why << endl; /* Avoid malloc(0), though it's not clear if it ever actually happens any more. */ diff --git a/vf.cpp b/vf.cpp index 101d8acc1..f70adba4e 100644 --- a/vf.cpp +++ b/vf.cpp @@ -63,7 +63,7 @@ extern font *define_font(FILE *file, unsigned int cmnd, font *vfparent, QIntDict void font::read_VF_index(unsigned int hushcs) { - kDebugInfo(DEBUG, 4300, "read_VF_index"); + kdDebug() << "read_VF_index" << endl; FILE *VF_file = file; unsigned char cmnd; @@ -71,14 +71,13 @@ void font::read_VF_index(unsigned int hushcs) flags |= FONT_VIRTUAL; set_char_p = set_vf_char; - kDebugInfo(DEBUG, 4300, "Reading VF pixel file %s", filename); + kdDebug() << "Reading VF pixel file " << filename << endl; // Read preamble. Fseek(VF_file, (long) one(VF_file), 1); /* skip comment */ long file_checksum = four(VF_file); if (!hushcs && file_checksum && checksum && file_checksum != checksum) - kDebugError("Checksum mismatch (dvi = %lu, vf = %lu) in font file %s", - checksum, file_checksum, filename); + kdError() << "Checksum mismatch (dvi = " << checksum << "u, vf = " << file_checksum << "u) in font file " << filename << endl; (void) four(VF_file); /* skip design size */ // Read the fonts. @@ -106,7 +105,7 @@ void font::read_VF_index(unsigned int hushcs) cc = four(VF_file); width = four(VF_file); if (cc >= 256) { - kDebugError(TRUE,4300,"Virtual character %lu in font %s ignored.", cc, fontname); + kdError() << "Virtual character " << cc << " in font " << fontname << " ignored." << endl; Fseek(VF_file, (long) len, 1); continue; } @@ -133,7 +132,6 @@ void font::read_VF_index(unsigned int hushcs) Fread((char *) m->pos, 1, len, VF_file); m->end = m->pos + len; } - kDebugInfo(DEBUG, 4300, "Read VF macro for character %lu; dy = %ld, length = %d",cc, m->dvi_adv, len); } if (cmnd != POST) oops("Wrong command byte found in VF macro list: %d", cmnd);