diff options
author | wlemb <wlemb> | 2004-04-08 20:43:20 +0000 |
---|---|---|
committer | wlemb <wlemb> | 2004-04-08 20:43:20 +0000 |
commit | 6db213602466ae985e880b2c7bc1fca73cdbf87b (patch) | |
tree | ea355d4fa460a526d24eea2bfceda73deb58a3a9 /src/devices/grolbp | |
parent | 8ceee8e98c76d3ba7c8fffa753ea6cf9570d4f10 (diff) | |
download | groff-6db213602466ae985e880b2c7bc1fca73cdbf87b.tar.gz |
* src/libs/libgroff/glyphuni.cpp (glyph_to_unicode_list),
src/libs/libgroff/uniglyph.cpp (unicode_to_glyph_list),
src/libs/libgroff/uniuni.cpp (unicode_decompose_list),
src/preproc/eqn/box.cpp (param_table), src/preproc/grn/hgraph.cpp
(polyfill), src/preproc/grn/main.cpp (polyfill),
src/preproc/refer/command.cpp (command_table),
src/utils/tfmtodit.cpp (lig_table): Don't use anonymous types (which
gcc 3.5 doesn't like).
Removing many compiler warnings. groff should now compile with
a C++ compiler used for C files also. [Simple variable renamings
to avoid shadowing aren't logged in detail.]
* src/devices/grodvi/dvi.cpp: Some local variable renamings.
(draw_dvi_printer::draw) ['c']: Enclose in block.
* src/devices/grohtml/post-html.cpp: Some local variable renamings.
(page::add_line): Fix typos.
* src/devices/grohtml/html-text.cpp: Some local variable renamings.
* src/devices/grolbp/lbp.cpp: Don't define _GNU_SOURCE.
Some local variable renamings.
* src/devices/grolbp/lbp.h: Some local variable renamings.
* src/devices/grolj4/lj4.cpp, src/devices/grotty/tty.cpp: Some local
variable renamings.
* src/libs/libbib/index.cpp (index_search_item_iterator::get_tag):
Remove redundant local variable declaration.
* src/libs/libbib/map.c (mapread, unmap): Don't use K&R style.
Don't use `caddr_t' but `void *'.
Enclose functions with `extern "C"' for C++.
* src/libs/libdriver/input.cpp (remember_filename,
remember_source_filename): Use cast for string constant.
* src/libs/libgroff/font.cpp, src/libs/libgroff/fontfile.cpp,
src/libs/libgroff/nametoindex.cpp, src/libs/libgroff/paper.cpp,
src/libs/libgroff/geometry.cpp: Some local variable renamings.
* src/libs/libgroff/iftoa.c, src/libs/libgroff/itoa.c: Don't use K&R
style.
Enclose functions with `extern "C"' for C++.
* src/libs/libgroff/quotearg.c (TRUE,FALSE): Define as macros.
(needs_quoting): Return `int'.
(quote_arg): Add proper casts to malloc and realloc.
* src/libs/libgroff/spawnvp.c: Compile code only for MS-DOS and
various MS Windows environments.
(spawnvp_wrapper): Add proper cast to malloc.
* src/preproc/eqn/box.h: Remove redundant declarations of
`make_script_box', `make_mark_box' and `make_lineup_box'.
* src/preproc/eqn/eqn.y: Remove redundant declaration of `strsave'.
* src/preproc/eqn/script.cpp, src/preproc/eqn/pile.cpp: Some local
variable renamings.
* src/preproc/grn/hpoint.cpp: Some local variable renamings.
* src/preproc/grn/hgraph.cpp: Some local variable renamings.
(dx, dy): Renamed functions to...
(deltax, deltay): This.
* src/preproc/grn/main.cpp: Some local variable renamings.
(deffont): Add `const'.
(initpic, conv): Use cast for string constant.
* src/preproc/html/pre-html.cpp: Some local variable renamings.
(makeFileName, alterDeviceTo, addZ): Use cast for string constant.
(char_buffer::run_output_filter): Second argument is unused.
* src/preproc/html/pushback.cpp: Some local variable renamings.
* src/preproc/pic/pic.y: Remove redundant declaration of `do_copy'.
* src/preproc/pic/object.cpp: Some local variable renamings.
* src/preproc/refer/label.y (lookup_label): Remove redundant
declaration of local variable.
* src/preproc/soelim.cpp: Remove redundant declaration of
`interpret_lf_args'.
* src/preproc/tbl/main.cpp: Some local variable renamings.
* src/roff/groff/groff.cpp (main): Use cast for string constant.
* src/roff/groff/pipeline.c: Enclose declarations of `error',
`c_fatal', and `i_to_a' with `extern "C"' for C++.
Don't use C++-style comments.
* src/roff/troff/env.h: Remove redundant declaration of `title'.
* src/roff/troff/node.h, src/roff/troff/env.cpp,
src/roff/troff/div.cpp, src/roff/troff/node.cpp: Some local variable
renamings.
* src/roff/troff/div.h: Remove redundant declaration of
`end_diversions'.
* src/roff/troff/troff.h: Remove redundant declaration of
`cleanup_and_exit'
* src/roff/troff/input.cpp: Remove redundant declaration of
`handle_first_page_transition' and `process_input_stack'.
* src/utils/hpftodit.cpp: Some local variable renamings.
* src/utils/indxbib/signal.c: Enclose functions with `extern "C"'
for C++.
Don't define RETSIGTYPE.
* src/utils/indxbib/indxbib.cpp: Some local variable renamings.
* src/utils/pfbtops/pfbtops.cpp: Don't use K&R style.
(error): Use `const' in argument.
(main): Remove redundant declaration of `optind'.
Move declaration of `Version_string' to top-level.
* PROBLEMS: Document difficulties compiling signal.c if a C++
compiler is used for C.
* Makefile.sub (DISTCLEANFILES): Add `test-groff'.
Diffstat (limited to 'src/devices/grolbp')
-rw-r--r-- | src/devices/grolbp/lbp.cpp | 10 | ||||
-rw-r--r-- | src/devices/grolbp/lbp.h | 173 |
2 files changed, 92 insertions, 91 deletions
diff --git a/src/devices/grolbp/lbp.cpp b/src/devices/grolbp/lbp.cpp index 1fb6fcc8..af5e2883 100644 --- a/src/devices/grolbp/lbp.cpp +++ b/src/devices/grolbp/lbp.cpp @@ -1,5 +1,6 @@ // -*- C++ -*- -/* Copyright (C) 1994, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. +/* Copyright (C) 1994, 2000, 2001, 2002, 2003, 2004 + Free Software Foundation, Inc. Written by Francisco Andrés Verdú <pandres@dragonet.es> with many ideas taken from the other groff drivers. @@ -25,9 +26,6 @@ TODO - Add X command to include bitmaps */ -#ifndef _GNU_SOURCE -#define _GNU_SOURCE -#endif #include "driver.h" #include "lbp.h" @@ -294,10 +292,10 @@ char *lbp_printer::font_name(const lbp_font *f, const int siz) return bfont_name; } -void lbp_printer::set_char(int index, font *f, const environment *env, +void lbp_printer::set_char(int idx, font *f, const environment *env, int w, const char *) { - int code = f->get_code(index); + int code = f->get_code(idx); unsigned char ch = code & 0xff; unsigned short symbol_set = code >> 8; if (f != cur_font) { diff --git a/src/devices/grolbp/lbp.h b/src/devices/grolbp/lbp.h index 6bb8f48e..0604af27 100644 --- a/src/devices/grolbp/lbp.h +++ b/src/devices/grolbp/lbp.h @@ -59,33 +59,33 @@ lbpputc(unsigned char c) static inline void -lbpsavestatus(int index ) +lbpsavestatus(int idx ) { - fprintf(lbpoutput,"\033[%d%%y",index); + fprintf(lbpoutput,"\033[%d%%y",idx); }; static inline void -lbprestorestatus(int index ) +lbprestorestatus(int idx ) { - fprintf(lbpoutput,"\033[%d%cz",index ,'%'); + fprintf(lbpoutput,"\033[%d%cz",idx ,'%'); }; static inline void -lbpsavepos(int index) +lbpsavepos(int idx) { - fprintf(lbpoutput,"\033[1;%d;0x",index); + fprintf(lbpoutput,"\033[1;%d;0x",idx); }; static inline void -lbprestorepos(int index) +lbprestorepos(int idx) { - fprintf(lbpoutput,"\033[0;%d;0x",index); + fprintf(lbpoutput,"\033[0;%d;0x",idx); }; static inline void -lbprestoreposx(int index) +lbprestoreposx(int idx) { - fprintf(lbpoutput,"\033[0;%d;1x",index); + fprintf(lbpoutput,"\033[0;%d;1x",idx); }; static inline void @@ -407,102 +407,105 @@ splinerel(double px,double py,int flush) * The following code to draw splines is adapted from the transfig package */ static void -quadratic_spline(double a1,double b1, double a2, double b2, \ - double a3, double b3, double a4, double b4) -{ - double x1, y1, x4, y4; - double xmid, ymid; - - x1 = a1; y1 = b1; - x4 = a4; y4 = b4; - xmid = (a2 + a3)/2.0; - ymid = (b2 + b3)/2.0; - if ((fabs(x1 - xmid) < THRESHOLD) && (fabs(y1 - ymid) < THRESHOLD)) { - splinerel(xmid,ymid,0); -/* fprintf(tfp, "PA%.4f,%.4f;\n", xmid, ymid);*/ +quadratic_spline(double a_1, double b_1, double a_2, double b_2, \ + double a_3, double b_3, double a_4, double b_4) +{ + double x_1, y_1, x_4, y_4; + double x_mid, y_mid; + + x_1 = a_1; y_1 = b_1; + x_4 = a_4; y_4 = b_4; + x_mid = (a_2 + a_3)/2.0; + y_mid = (b_2 + b_3)/2.0; + if ((fabs(x_1 - x_mid) < THRESHOLD) + && (fabs(y_1 - y_mid) < THRESHOLD)) { + splinerel(x_mid, y_mid, 0); +/* fprintf(tfp, "PA%.4f,%.4f;\n", x_mid, y_mid);*/ } else { - quadratic_spline(x1, y1, ((x1+a2)/2.0), ((y1+b2)/2.0), - ((3.0*a2+a3)/4.0), ((3.0*b2+b3)/4.0), xmid, ymid); - } + quadratic_spline(x_1, y_1, ((x_1+a_2)/2.0), ((y_1+b_2)/2.0), + ((3.0*a_2+a_3)/4.0), ((3.0*b_2+b_3)/4.0), x_mid, y_mid); + } - if ((fabs(xmid - x4) < THRESHOLD) && (fabs(ymid - y4) < THRESHOLD)) { - splinerel(x4,y4,0); -/* fprintf(tfp, "PA%.4f,%.4f;\n", x4, y4);*/ + if ((fabs(x_mid - x_4) < THRESHOLD) + && (fabs(y_mid - y_4) < THRESHOLD)) { + splinerel(x_4, y_4, 0); +/* fprintf(tfp, "PA%.4f,%.4f;\n", x_4, y_4);*/ } else { - quadratic_spline(xmid, ymid, ((a2+3.0*a3)/4.0), ((b2+3.0*b3)/4.0), - ((a3+x4)/2.0), ((b3+y4)/2.0), x4, y4); - }; + quadratic_spline(x_mid, y_mid, + ((a_2+3.0*a_3)/4.0), ((b_2+3.0*b_3)/4.0), + ((a_3+x_4)/2.0), ((b_3+y_4)/2.0), x_4, y_4); + }; }; /* quadratic_spline */ #define XCOORD(i) numbers[(2*i)] #define YCOORD(i) numbers[(2*i)+1] static void -vdmspline(int numpoints, int ox,int oy, int *numbers) +vdmspline(int numpoints, int o_x, int o_y, int *numbers) { - double cx1, cy1, cx2, cy2, cx3, cy3, cx4, cy4; - double x1, y1, x2, y2; + double cx_1, cy_1, cx_2, cy_2, cx_3, cy_3, cx_4, cy_4; + double x_1, y_1, x_2, y_2; char xcoord[4],ycoord[4]; int i; /*p = s->points; - x1 = p->x/ppi;*/ - x1 = ox; - y1 = oy; + x_1 = p->x/ppi;*/ + x_1 = o_x; + y_1 = o_y; /* p = p->next; - x2 = p->x/ppi; - y2 = p->y/ppi;*/ - x2 = ox + XCOORD(0); - y2 = oy + YCOORD(0); - cx1 = (x1 + x2)/2.0; - cy1 = (y1 + y2)/2.0; - cx2 = (x1 + 3.0*x2)/4.0; - cy2 = (y1 + 3.0*y2)/4.0; - -/* fprintf(stderr,"Spline %d (%d,%d)\n",numpoints,(int)x1,(int)y1);*/ - vdmprintf("1%s%s",vdmnum((int)x1,xcoord),vdmnum((int)y1,ycoord)); - splinerel(x1,y1,-1); - splinerel(cx1,cy1,0); + x_2 = p->x/ppi; + y_2 = p->y/ppi;*/ + x_2 = o_x + XCOORD(0); + y_2 = o_y + YCOORD(0); + cx_1 = (x_1 + x_2)/2.0; + cy_1 = (y_1 + y_2)/2.0; + cx_2 = (x_1 + 3.0*x_2)/4.0; + cy_2 = (y_1 + 3.0*y_2)/4.0; + +/* fprintf(stderr,"Spline %d (%d,%d)\n",numpoints,(int)x_1,(int)y_1);*/ + vdmprintf("1%s%s",vdmnum((int)x_1,xcoord),vdmnum((int)y_1,ycoord)); + splinerel(x_1,y_1,-1); + splinerel(cx_1,cy_1,0); /* fprintf(tfp, "PA%.4f,%.4f;PD%.4f,%.4f;\n", - x1, y1, cx1, cy1);*/ + x_1, y_1, cx_1, cy_1);*/ /*for (p = p->next; p != NULL; p = p->next) {*/ for (i = 1; i < (numpoints); i++) { - x1 = x2; - y1 = y2; -/* x2 = p->x/ppi; - y2 = p->y/ppi;*/ - x2 = x1 + XCOORD(i); - y2 = y1 + YCOORD(i); - cx3 = (3.0*x1 + x2)/4.0; - cy3 = (3.0*y1 + y2)/4.0; - cx4 = (x1 + x2)/2.0; - cy4 = (y1 + y2)/2.0; - /* fprintf(stderr,"Point (%d,%d) - (%d,%d)\n",(int)x1,(int)(y1),(int)x2,(int)y2);*/ - quadratic_spline(cx1, cy1, cx2, cy2, cx3, cy3, cx4, cy4); - cx1 = cx4; - cy1 = cy4; - cx2 = (x1 + 3.0*x2)/4.0; - cy2 = (y1 + 3.0*y2)/4.0; - } - x1 = x2; - y1 = y2; -/* p = s->points->next; - x2 = p->x/ppi; - y2 = p->y/ppi;*/ - x2 = ox + XCOORD(0); - y2 = oy + YCOORD(0); - cx3 = (3.0*x1 + x2)/4.0; - cy3 = (3.0*y1 + y2)/4.0; - cx4 = (x1 + x2)/2.0; - cy4 = (y1 + y2)/2.0; - splinerel(x1,y1,0); - splinerel(x1,y1,1); - /*vdmprintf("%s%s",vdmnum((int)(x1-lx),xcoord),\ - vdmnum((int)(y1-ly),ycoord));*/ + x_1 = x_2; + y_1 = y_2; +/* x_2 = p->x/ppi; + y_2 = p->y/ppi;*/ + x_2 = x_1 + XCOORD(i); + y_2 = y_1 + YCOORD(i); + cx_3 = (3.0*x_1 + x_2)/4.0; + cy_3 = (3.0*y_1 + y_2)/4.0; + cx_4 = (x_1 + x_2)/2.0; + cy_4 = (y_1 + y_2)/2.0; + /* fprintf(stderr,"Point (%d,%d) - (%d,%d)\n",(int)x_1,(int)(y_1),(int)x_2,(int)y_2);*/ + quadratic_spline(cx_1, cy_1, cx_2, cy_2, cx_3, cy_3, cx_4, cy_4); + cx_1 = cx_4; + cy_1 = cy_4; + cx_2 = (x_1 + 3.0*x_2)/4.0; + cy_2 = (y_1 + 3.0*y_2)/4.0; + } + x_1 = x_2; + y_1 = y_2; +/* p = s->points->next; + x_2 = p->x/ppi; + y_2 = p->y/ppi;*/ + x_2 = o_x + XCOORD(0); + y_2 = o_y + YCOORD(0); + cx_3 = (3.0*x_1 + x_2)/4.0; + cy_3 = (3.0*y_1 + y_2)/4.0; + cx_4 = (x_1 + x_2)/2.0; + cy_4 = (y_1 + y_2)/2.0; + splinerel(x_1, y_1, 0); + splinerel(x_1, y_1, 1); + /*vdmprintf("%s%s",vdmnum((int)(x_1-lx),xcoord),\ + vdmnum((int)(y_1-ly),ycoord));*/ vdmprintf("\x1e\n"); -/* fprintf(tfp, "PA%.4f,%.4f;PU;\n", x1, y1);*/ +/* fprintf(tfp, "PA%.4f,%.4f;PU;\n", x_1, y_1);*/ }; /* vdmspline */ |