From 738715858a0ca28ce4a85e0b556e09368e96cdf0 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Sat, 10 Nov 2018 21:46:24 +0100 Subject: Mark debugging messages as non-translatable --- src/frame.c | 105 ++++++++++++++++++++++++++++++------------------------------ 1 file changed, 53 insertions(+), 52 deletions(-) (limited to 'src/frame.c') diff --git a/src/frame.c b/src/frame.c index 6f11d34..794d49e 100644 --- a/src/frame.c +++ b/src/frame.c @@ -110,7 +110,7 @@ struct frame *frame_new() n->children = NULL; n->max_children = 32; if ( alloc_ro(n) ) { - fprintf(stderr, _("Couldn't allocate children\n")); + fprintf(stderr, "Couldn't allocate children\n"); free(n); return NULL; } @@ -188,7 +188,7 @@ void show_frame_hierarchy(struct frame *fr, const char *t) strcpy(tn, t); strcat(tn, " "); - printf(_("%s%p (%.2f x %.2f)\n"), t, fr, fr->w, fr->h); + printf("%s%p (%.2f x %.2f)\n", t, fr, fr->w, fr->h); for ( i=0; inum_children; i++ ) { show_frame_hierarchy(fr->children[i], tn); @@ -216,12 +216,12 @@ struct frame *find_frame_with_scblocks(struct frame *fr, SCBlock *scblocks) static const char *text_for_run(const struct text_run *run) { if ( run == NULL ) { - fprintf(stderr, _("NULL run passed to text_for_run\n")); + fprintf(stderr, "NULL run passed to text_for_run\n"); return 0; } if ( run->scblock == NULL ) { - fprintf(stderr, _("NULL scblock in text_for_run\n")); + fprintf(stderr, "NULL scblock in text_for_run\n"); return 0; } @@ -236,12 +236,12 @@ static const char *text_for_run(const struct text_run *run) static size_t run_text_len(const struct text_run *run) { if ( run == NULL ) { - fprintf(stderr, _("NULL run passed to run_text_len\n")); + fprintf(stderr, "NULL run passed to run_text_len\n"); return 0; } if ( run->scblock == NULL ) { - fprintf(stderr, _("NULL scblock in run_text_len\n")); + fprintf(stderr, "NULL scblock in run_text_len\n"); return 0; } @@ -250,7 +250,7 @@ static size_t run_text_len(const struct text_run *run) } if ( sc_block_contents(run->scblock) == NULL ) { - fprintf(stderr, _("NULL scblock contents in run_text_len\n")); + fprintf(stderr, "NULL scblock contents in run_text_len\n"); return 0; } @@ -288,7 +288,7 @@ void wrap_paragraph(Paragraph *para, PangoContext *pc, double w, /* Allocate the complete text */ text = malloc(total_len+1); if ( text == NULL ) { - fprintf(stderr, _("Couldn't allocate combined text (%lli)\n"), + fprintf(stderr, "Couldn't allocate combined text (%lli)\n", (long long int)total_len); return; } @@ -375,7 +375,7 @@ void add_run(Paragraph *para, SCBlock *scblock, runs_new = realloc(para->runs, (para->n_runs+1)*sizeof(struct text_run)); if ( runs_new == NULL ) { - fprintf(stderr, _("Failed to add run.\n")); + fprintf(stderr, "Failed to add run.\n"); return; } @@ -433,7 +433,7 @@ Paragraph *insert_paragraph(struct frame *fr, int pos) int i; if ( pos >= fr->n_paras ) { - fprintf(stderr, _("insert_paragraph(): pos too high!\n")); + fprintf(stderr, "insert_paragraph(): pos too high!\n"); return NULL; } @@ -467,7 +467,7 @@ Paragraph *add_callback_para(struct frame *fr, SCBlock *bl, double w, double h, } else { pnew = create_paragraph(fr, bl); if ( pnew == NULL ) { - fprintf(stderr, _("Failed to add callback paragraph\n")); + fprintf(stderr, "Failed to add callback paragraph\n"); return NULL; } } @@ -495,7 +495,7 @@ void add_image_para(struct frame *fr, SCBlock *scblock, int wi, hi; if ( is == NULL ) { - fprintf(stderr, _("Adding image without ImageStore!\n")); + fprintf(stderr, "Adding image without ImageStore!\n"); return; } @@ -504,13 +504,14 @@ void add_image_para(struct frame *fr, SCBlock *scblock, } else { pnew = create_paragraph(fr, scblock); if ( pnew == NULL ) { - fprintf(stderr, _("Failed to add image paragraph\n")); + fprintf(stderr, "Failed to add image paragraph\n"); return; } } if ( imagestore_get_size(is, filename, &wi, &hi) ) { - fprintf(stderr, _("Couldn't get size for %s\n"), filename); + fprintf(stderr, _("Couldn't determine size of image '%s'\n"), + filename); wi = 100; hi = 100; } @@ -612,7 +613,7 @@ void render_paragraph(cairo_t *cr, Paragraph *para, ImageStore *is) if ( surf != NULL ) { render_from_surf(surf, cr, para->image_w, para->image_h, 0); } else { - printf(_("surf = NULL!\n")); + printf("surf = NULL!\n"); } break; @@ -656,7 +657,7 @@ static size_t text_para_pos(Paragraph *para, double x, double y, int *ptrail) void show_edit_pos(struct edit_pos a) { - printf(_("para %i, pos %li, trail %i\n"), a.para, (long int)a.pos, a.trail); + printf("para %i, pos %li, trail %i\n", a.para, (long int)a.pos, a.trail); } @@ -701,7 +702,7 @@ void ensure_run(struct frame *fr, struct edit_pos cpos) bl = sc_block_prepend(para->scblock, fr->scblocks); if ( bl == NULL ) { - fprintf(stderr, _("Couldn't prepend block\n")); + fprintf(stderr, "Couldn't prepend block\n"); return; } sc_block_set_contents(bl, strdup("")); @@ -727,7 +728,7 @@ int find_cursor(struct frame *fr, double x, double y, struct edit_pos *pos) int i; if ( fr == NULL ) { - fprintf(stderr, _("Cursor frame is NULL.\n")); + fprintf(stderr, "Cursor frame is NULL.\n"); return 1; } @@ -751,7 +752,7 @@ int find_cursor(struct frame *fr, double x, double y, struct edit_pos *pos) } if ( fr->n_paras == 0 ) { - printf(_("No paragraphs in frame.\n")); + printf("No paragraphs in frame.\n"); return 1; } @@ -772,12 +773,12 @@ int get_para_highlight(struct frame *fr, int cursor_para, double py = 0.0; if ( fr == NULL ) { - fprintf(stderr, _("Cursor frame is NULL.\n")); + fprintf(stderr, "Cursor frame is NULL.\n"); return 1; } if ( cursor_para >= fr->n_paras ) { - fprintf(stderr, _("Highlight paragraph number is too high!\n")); + fprintf(stderr, "Highlight paragraph number is too high!\n"); return 1; } @@ -803,12 +804,12 @@ int get_cursor_pos(struct frame *fr, int cursor_para, int cursor_pos, double py = 0.0; if ( fr == NULL ) { - fprintf(stderr, _("Cursor frame is NULL.\n")); + fprintf(stderr, "Cursor frame is NULL.\n"); return 1; } if ( cursor_para >= fr->n_paras ) { - fprintf(stderr, _("Cursor paragraph number is too high!\n")); + fprintf(stderr, "Cursor paragraph number is too high!\n"); return 1; } @@ -927,7 +928,7 @@ size_t pos_trail_to_offset(Paragraph *para, size_t offs, int trail) nrun = which_run(para, offs); if ( nrun == para->n_runs ) { - fprintf(stderr, _("pos_trail_to_offset: Offset too high\n")); + fprintf(stderr, "pos_trail_to_offset: Offset too high\n"); return 0; } @@ -940,20 +941,20 @@ size_t pos_trail_to_offset(Paragraph *para, size_t offs, int trail) if ( para->type != PARA_TYPE_TEXT ) return 0; if ( run == NULL ) { - fprintf(stderr, _("pos_trail_to_offset: No run\n")); + fprintf(stderr, "pos_trail_to_offset: No run\n"); return 0; } if ( run->scblock == NULL ) { - fprintf(stderr, _("pos_trail_to_offset: SCBlock = NULL?\n")); + fprintf(stderr, "pos_trail_to_offset: SCBlock = NULL?\n"); return 0; } /* Get the text for the run */ run_text = text_for_run(run); if ( run_text == NULL ) { - fprintf(stderr, _("pos_trail_to_offset: No contents " - "(%p name=%s, options=%s)\n"), + fprintf(stderr, "pos_trail_to_offset: No contents " + "(%p name=%s, options=%s)\n", run->scblock, sc_block_name(run->scblock), sc_block_options(run->scblock)); return 0; @@ -968,8 +969,8 @@ size_t pos_trail_to_offset(Paragraph *para, size_t offs, int trail) char_offs += trail; if ( char_offs > g_utf8_strlen(run_text, -1) ) { - printf(_("Offset outside string! '%s'\n" - "char_offs %li offs %li len %li\n"), + printf("Offset outside string! '%s'\n" + "char_offs %li offs %li len %li\n", run_text, (long int)char_offs, (long int)offs, (long int)g_utf8_strlen(run_text, -1)); } @@ -986,26 +987,26 @@ int position_editable(struct frame *fr, struct edit_pos cp) size_t paraoffs; if ( fr == NULL ) { - fprintf(stderr, _("Frame is NULL.\n")); + fprintf(stderr, "Frame is NULL.\n"); return 0; } if ( cp.para >= fr->n_paras ) { - fprintf(stderr, _("Paragraph number is too high!\n")); + fprintf(stderr, "Paragraph number is too high!\n"); return 0; } para = fr->paras[cp.para]; if ( para->type != PARA_TYPE_TEXT ) { - fprintf(stderr, _("Paragraph is not text.\n")); + fprintf(stderr, "Paragraph is not text.\n"); return 0; } paraoffs = pos_trail_to_offset(para, cp.pos, cp.trail); run = which_run(para, paraoffs); if ( run == para->n_runs ) { - fprintf(stderr, _("Couldn't find run!\n")); + fprintf(stderr, "Couldn't find run!\n"); return 0; } @@ -1022,12 +1023,12 @@ void insert_text_in_paragraph(Paragraph *para, size_t offs, const char *t) /* Find which run we are in */ nrun = which_run(para, offs); if ( nrun == para->n_runs ) { - fprintf(stderr, _("Couldn't find run to insert into.\n")); + fprintf(stderr, "Couldn't find run to insert into.\n"); return; } if ( para->n_runs == 0 ) { - printf(_("No runs in paragraph?\n")); + printf("No runs in paragraph?\n"); } else { struct text_run *run; size_t run_offs; @@ -1108,7 +1109,7 @@ static int pos_to_run_number(struct frame *fr, struct edit_pos p) static void delete_run(Paragraph *para, int nrun) { - printf(_("deleting run %i of %i from para %p\n"), nrun, para->n_runs, para); + printf("deleting run %i of %i from para %p\n", nrun, para->n_runs, para); memmove(¶->runs[nrun], ¶->runs[nrun+1], (para->n_runs-nrun-1)*sizeof(struct text_run)); para->n_runs--; @@ -1194,7 +1195,7 @@ static int paragraph_number(struct frame *fr, Paragraph *p, int *err) for ( i=0; in_paras; i++ ) { if ( fr->paras[i] == p ) return i; } - fprintf(stderr, _("Couldn't find paragraph %p\n"), p); + fprintf(stderr, "Couldn't find paragraph %p\n", p); *err = 1; return 0; } @@ -1216,11 +1217,11 @@ static void delete_paragraph(struct frame *fr, Paragraph *para, int *pnp) { int pn = find_para(fr, para); if ( pn == fr->n_paras ) { - fprintf(stderr, _("Couldn't find paragraph to delete (%p)\n"), para); + fprintf(stderr, "Couldn't find paragraph to delete (%p)\n", para); return; } - printf(_("deleting paragraph %i (%p)\n"), pn, para); + printf("deleting paragraph %i (%p)\n", pn, para); memmove(&fr->paras[pn], &fr->paras[pn+1], (fr->n_paras-pn-1)*sizeof(Paragraph *)); @@ -1247,7 +1248,7 @@ static void delete_run_for_scblock(struct frame *fr, para = find_run_for_scblock(fr, pn1, pn2, bl, &run); if ( para == NULL ) { - fprintf(stderr, _("Couldn't find block %p between paragraphs %p and %p\n"), + fprintf(stderr, "Couldn't find block %p between paragraphs %p and %p\n", bl, p1, p2); return; } @@ -1269,7 +1270,7 @@ static signed int merge_paragraph_runs(Paragraph *p1, Paragraph *p2) runs_new = realloc(p1->runs, (p1->n_runs+p2->n_runs)*sizeof(struct text_run)); if ( runs_new == NULL ) { - fprintf(stderr, _("Failed to allocate merged runs.\n")); + fprintf(stderr, "Failed to allocate merged runs.\n"); return -1; } p1->runs = runs_new; @@ -1312,7 +1313,7 @@ static void merge_paragraphs_by_newpara(struct frame *fr, SCBlock *np) show_para(p2); spos = merge_paragraph_runs(p1, p2); if ( spos < 0 ) { - fprintf(stderr, _("Failed to merge paragraphs\n")); + fprintf(stderr, "Failed to merge paragraphs\n"); return; } printf("-------------------------------\n"); @@ -1328,7 +1329,7 @@ static void merge_paragraphs_by_newpara(struct frame *fr, SCBlock *np) } } - fprintf(stderr, _("Couldn't find paragraphs to merge by newpara\n")); + fprintf(stderr, "Couldn't find paragraphs to merge by newpara\n"); } @@ -1388,7 +1389,7 @@ void delete_text_from_frame(struct frame *fr, struct edit_pos p1, struct edit_po } if ( !position_editable(fr, p1) || !position_editable(fr, p2) ) { - fprintf(stderr, _("Delete outside editable region\n")); + fprintf(stderr, "Delete outside editable region\n"); return; } @@ -1529,24 +1530,24 @@ void delete_text_from_frame(struct frame *fr, struct edit_pos p1, struct edit_po void show_para(Paragraph *p) { - printf(_("Paragraph %p\n"), p); + printf("Paragraph %p\n", p); if ( p->type == PARA_TYPE_TEXT ) { int i; - printf(_("%i runs:\n"), p->n_runs); + printf("%i runs:\n", p->n_runs); for ( i=0; in_runs; i++ ) { - printf(_(" Run %2i: SCBlock %p %s '%s'\n"), + printf(" Run %2i: SCBlock %p %s '%s'\n", i, p->runs[i].scblock, pango_font_description_to_string(p->runs[i].fontdesc), sc_block_contents(p->runs[i].scblock)); } } else if ( p->type == PARA_TYPE_IMAGE ) { - printf(_(" Image: %s\n"), p->filename); + printf(" Image: %s\n", p->filename); } else { - printf(_(" Other paragraph type\n")); + printf(" Other paragraph type\n"); } } @@ -1564,7 +1565,7 @@ static SCBlock *split_text_paragraph(struct frame *fr, int pn, size_t pos, pnew = insert_paragraph(fr, pn); if ( pnew == NULL ) { - fprintf(stderr, _("Failed to insert paragraph\n")); + fprintf(stderr, "Failed to insert paragraph\n"); return NULL; } @@ -1723,7 +1724,7 @@ int get_sc_pos(struct frame *fr, int pn, size_t pos, nrun = which_run(para, pos); if ( nrun == para->n_runs ) { - fprintf(stderr, _("Couldn't find run to insert into.\n")); + fprintf(stderr, "Couldn't find run to insert into.\n"); return 1; } run = ¶->runs[nrun]; -- cgit v1.2.3