# HG changeset patch # User Matti Hamalainen # Date 1274980568 -10800 # Node ID 77f40a3c0095d8f3ac8674ec68145bcb93d8b9a3 # Parent 85671798fdb3a043e7928bcc543b9e6a5045f665 Cleanups. diff -r 85671798fdb3 -r 77f40a3c0095 pwplib/attrconv.c --- a/pwplib/attrconv.c Wed May 26 01:22:51 2010 +0300 +++ b/pwplib/attrconv.c Thu May 27 20:16:08 2010 +0300 @@ -1,7 +1,6 @@ #include #include -#include "pwplib.h" #include "convert.h" /* @@ -9,10 +8,9 @@ * */ -void convcalc_1to12() /* &1 == ibm2ibm, */ +void convcalc_1to12(void) /* &1 == ibm2ibm, */ { - u8 tabsrc[]= - { + static const u8 tabsrc[] = { '\"', '\"',' ', '/', '|','/', '\'', '\'',' ', @@ -64,14 +62,11 @@ 223, 219, 32, 0 }; - u8*t=tabsrc; - - int i=0; + const u8 *t = tabsrc; + int i; - for(;i<256;i++) - { + for(i = 0;i<256;i++) pwpconv.tab1to12[i]=BYTES2(pwpconv.font[i],32); - } while(*t) { @@ -80,7 +75,7 @@ } } -void conv_1to12(u8*d,u8*s,int w,int h) +static void conv_1to12(u8*d,u8*s,int w,int h) { w<<=1; for(;h;h--) @@ -111,7 +106,7 @@ * purely font/charset related */ -void convcalc_ascii() +void convcalc_ascii(int x) { memcpy(pwpconv.font, /*00*/ " OOwoxAoooo6qrn*" @@ -132,7 +127,7 @@ /*F0*/ "=+><|J%~o-.Vn2o ",256*sizeof(char)); } -void convcalc_termsafe() +void convcalc_termsafe(void) { int i=256;u8*s=pwpconv.font; for(;i;i--) @@ -151,12 +146,12 @@ memset(pwpconv.col,(parms&1)?0x00:0x07,256*sizeof(u8)); } -void convcalc_monotab_attr(int parms) +static void convcalc_monotab_attr(int parms) { u8 attrmo[2][2]= /* &1: 0=ansicol_dump, 1=vt_dump */ { - 0x00,0x01, - 0x07,0x70 + { 0x00,0x01 }, + { 0x07,0x70 } }; const char intens[16]= @@ -289,7 +284,7 @@ /*******************************/ -void conv_dump_ibm_megatab() +void conv_dump_ibm_megatab(void) { TEMPMALL(u16,tmp,pwplib.videobuf.height*pwplib.videobuf.width*2), *s=(u16*)pwplib.videobuf.d,*d=tmp; @@ -306,7 +301,7 @@ TEMPFREE(tmp); } -void conv_fromibm_double() +static void conv_fromibm_double(void) { int lgt=pwplib.videobuf.width*pwplib.videobuf.height; @@ -314,7 +309,7 @@ conv_1to12(tmp,pwplib.videobuf.d,pwplib.videobuf.width,pwplib.videobuf.height); - {char*save=pwplib.videobuf.d; + {u8 *save=pwplib.videobuf.d; pwplib.videobuf.d=tmp; pwplib.videobuf.height<<=1; conv_dump_ibm_megatab(); @@ -325,7 +320,7 @@ TEMPFREE(tmp); } -void conv_fromibm_half() +static void conv_fromibm_half(void) { TEMPMALL(u8,tmp,pwplib.videobuf.width*pwplib.videobuf.height), *d=tmp,*s=pwplib.videobuf.d; @@ -346,7 +341,7 @@ s+=w; } - {char*save=pwplib.videobuf.d; + {u8 *save=pwplib.videobuf.d; pwplib.videobuf.d=tmp; pwplib.videobuf.height>>=1; conv_dump_ibm_megatab(); @@ -359,7 +354,7 @@ } /* dump_ibm_halved, dump_ibm_realsize */ -void conv_dump_ibm() +void conv_dump_ibm(void) { if(pwplib.setup[SETUP_HALVE]) { diff -r 85671798fdb3 -r 77f40a3c0095 pwplib/colorterm.c --- a/pwplib/colorterm.c Wed May 26 01:22:51 2010 +0300 +++ b/pwplib/colorterm.c Thu May 27 20:16:08 2010 +0300 @@ -136,7 +136,7 @@ /****************/ /* ..do a generic tty_dump_attr that calls pwp_tty.indump or something */ -void tty_ansicol_dump_attr() +void tty_ansicol_dump_attr(void) { int lgt= tty_ansicol_dump @@ -169,12 +169,12 @@ usleep(pwplib.set.framedelay*1000); } -void tty_ansicol_prep_attr() +void tty_ansicol_prep_attr(void) { tty_write("\33[37;40m[2J\33[H",-1); } -void tty_ansicol_init() +void tty_ansicol_init(void) { pwplib.prep_attr=tty_ansicol_prep_attr; pwplib.dump_attr=tty_ansicol_dump_attr; @@ -184,7 +184,7 @@ tty_vt_initstring(); } -void tty_ansisys_init() +void tty_ansisys_init(void) { pwplib.prep_attr=tty_ansicol_prep_attr; pwplib.dump_attr=tty_ansicol_dump_attr; diff -r 85671798fdb3 -r 77f40a3c0095 pwplib/convert.c --- a/pwplib/convert.c Wed May 26 01:22:51 2010 +0300 +++ b/pwplib/convert.c Thu May 27 20:16:08 2010 +0300 @@ -3,11 +3,8 @@ #include #include -#include "pwplib.h" #include "convert.h" -extern void conv_dump_ibm(); -extern void conv_dump_rast(); void conv_init(int colors,int chars,int rasters) { diff -r 85671798fdb3 -r 77f40a3c0095 pwplib/convert.h --- a/pwplib/convert.h Wed May 26 01:22:51 2010 +0300 +++ b/pwplib/convert.h Thu May 27 20:16:08 2010 +0300 @@ -20,5 +20,23 @@ void(*orig_dump_attr)(); } pwpconv; +/* convert.c */ +void conv_init(int colors,int chars,int rasters); + +/* attrconv.c */ +void convcalc_1to12(void); +void convcalc_ascii(int x); +void convcalc_termsafe(void); +void convcalc_monotab(int parms); +void convcalc_colortab(int parms); +void convcalc_megatab_finish(int flags); +void conv_dump_ibm_megatab(void); +void conv_dump_ibm(void); + +/* rastconv.c */ +void convcalc_rast_ibmcol(void); +void conv_dump_rast(void); +void convcalc_rast_col(void); +void convcalc_rast_mono(void); #endif /* PWP_CONVERT_H */ diff -r 85671798fdb3 -r 77f40a3c0095 pwplib/decterm.c --- a/pwplib/decterm.c Wed May 26 01:22:51 2010 +0300 +++ b/pwplib/decterm.c Thu May 27 20:16:08 2010 +0300 @@ -317,9 +317,6 @@ /***************************************************/ -void tty_ansicol_dump_attr(); -void tty_ansicol_prep_attr(); - void tty_vt1xx_init() { pwplib.dump_attr=tty_vt_dump_attr; @@ -362,6 +359,5 @@ } #endif -#endif -#endif - +#endif /* DRIVE_TTY_DEC */ +#endif /* DRIVE_UNIX */ diff -r 85671798fdb3 -r 77f40a3c0095 pwplib/glyphgen.c --- a/pwplib/glyphgen.c Wed May 26 01:22:51 2010 +0300 +++ b/pwplib/glyphgen.c Thu May 27 20:16:08 2010 +0300 @@ -9,7 +9,6 @@ #include #include "pwplib.h" - #include "tty.h" #include "convert.h" diff -r 85671798fdb3 -r 77f40a3c0095 pwplib/linuxcon.c --- a/pwplib/linuxcon.c Wed May 26 01:22:51 2010 +0300 +++ b/pwplib/linuxcon.c Thu May 27 20:16:08 2010 +0300 @@ -25,7 +25,7 @@ void vcsa_dump_attr() { - char*buf=pwplib.videobuf.d; + u8 *buf=pwplib.videobuf.d; int ptr=4+pwp_linuxcon.width* ((pwp_linuxcon.height-pwplib.videobuf.height)&~1); if(ptr<4)ptr=4; @@ -122,9 +122,8 @@ /********************************************/ -enum -{ - GLY_CRAP=0, +enum { + GLY_CRAP = 0, GLY_BLANK, GLY_FULL, GLY_TOP, @@ -133,7 +132,7 @@ GLY_RIGHT, }; -int tty_linux_setfont(char*fontd,int w,int h) +static int tty_linux_setfont(u8 *fontd,int w,int h) { struct console_font_op fontop; fontop.op=KD_FONT_OP_SET; @@ -146,11 +145,10 @@ return ioctl(2,KDFONTOP,&fontop); } -int tty_linux_setfont_tab() +static int tty_linux_setfont_tab() { - char*font=malloc(pwp_linuxcon.fontw*32*sizeof(char)); - char*f=font, - *s=pwp_linuxcon.fontd_tab; + u8 *f, *font = malloc(pwp_linuxcon.fontw*32*sizeof(char)); + char *s = pwp_linuxcon.fontd_tab; int i,x,y; @@ -180,7 +178,7 @@ return tty_linux_setfont(font,pwp_linuxcon.fontw,pwp_linuxcon.fonth); } -void tty_linux_restorefont() +void tty_linux_restorefont(void) { tty_linux_setfont( pwp_linuxcon.fontd, @@ -207,12 +205,12 @@ /**********************************/ -int tty_linux_analyzefont() +static int tty_linux_analyzefont() { u8 analysis[256]; u8*s=pwp_linuxcon.fontd; - char*d=pwp_linuxcon.fontd_tab; +/* char*d=pwp_linuxcon.fontd_tab; */ int c=0; /* fprintf(stderr,"font analysis?\n");*/ @@ -345,9 +343,6 @@ /********************************************************/ -extern void tty_ansicol_dump_attr(); -extern void tty_ansicol_prep_attr(); - int tty_linux_initstring() { write(pwp_tty.fd,"\33[11m",5*sizeof(char)); /* select ibmpc charset */ diff -r 85671798fdb3 -r 77f40a3c0095 pwplib/rastconv.c --- a/pwplib/rastconv.c Wed May 26 01:22:51 2010 +0300 +++ b/pwplib/rastconv.c Thu May 27 20:16:08 2010 +0300 @@ -1,13 +1,12 @@ #include #include -#include "pwplib.h" #include "convert.h" #include "tty.h" /*** funx ***/ -int conv_rast2rgb(int i) +static int conv_rast2rgb(int i) { int r=0,g=0,b=0; @@ -38,7 +37,7 @@ return (r<<8)|(g<<4)|b; } -int conv_rgbdiff(int a,int b) +static int conv_rgbdiff(int a,int b) { int rd=((a>>8)&15)-((b>>8)&15); int gd=((a>>4)&15)-((b>>4)&15); @@ -49,7 +48,7 @@ /*** table generators ***/ -void convcalc_rast_ibmcol() +void convcalc_rast_ibmcol(void) { const char intens[16]= { @@ -82,7 +81,7 @@ } } -void convcalc_rast_col() +void convcalc_rast_col(void) { const char convtab[8*8]= " .,%xuow" @@ -129,8 +128,6 @@ } } -extern void tty_vt_dump_attr(); - void convcalc_rast_mono() { const char intens[16]= @@ -151,9 +148,9 @@ /* kludge.. */ #ifndef __POSIX__ - int col=0x07; + int col = 0x07; #else - int col=(pwplib.dump_attr==tty_vt_dump_attr)?0x00:0x07; + int col = (pwplib.dump_attr == tty_vt_dump_attr) ? 0x00 : 0x07; #endif int up,dn; @@ -215,7 +212,7 @@ /*********************************/ -void conv_dump_rast() +void conv_dump_rast(void) { TEMPMALL(u8,tmp,pwplib.videobuf.height*pwplib.videobuf.width*2); diff -r 85671798fdb3 -r 77f40a3c0095 pwplib/tty.c --- a/pwplib/tty.c Wed May 26 01:22:51 2010 +0300 +++ b/pwplib/tty.c Thu May 27 20:16:08 2010 +0300 @@ -11,12 +11,12 @@ #ifdef HAVE_TTYSTUFF -void tty_restore_termios(void) +static void tty_restore_termios(void) { tcsetattr(STDIN,TCSADRAIN,&pwp_tty.setup); } -void tty_init_termios(void) +static void tty_init_termios(void) { struct termios t; tcgetattr(STDIN,&t); @@ -32,7 +32,7 @@ pwplib_regdestr(tty_restore_termios); } -void tty_getwinsize(void) +static void tty_getwinsize(void) { # ifdef TIOCGWINSZ {struct winsize wsz; @@ -61,7 +61,7 @@ /******************************************************************/ -void tty_probe_raw(void) +static void tty_probe_raw(void) { fd_set fdset; struct timeval timeout; @@ -150,7 +150,7 @@ /******************************************************************/ -int tty_probe(void) +static int tty_probe(void) { char*tt; diff -r 85671798fdb3 -r 77f40a3c0095 pwplib/tty.h --- a/pwplib/tty.h Wed May 26 01:22:51 2010 +0300 +++ b/pwplib/tty.h Thu May 27 20:16:08 2010 +0300 @@ -47,4 +47,22 @@ int tty_init(void); void tty_write(u8 *data, int lgt); +#ifdef DRIVE_TTY_DEC +void tty_vt_dump_attr(); +void tty_vt_initstring(); +#endif + +#ifdef HAVE_TTYSTUFF +int tty_dumb_init(); +#endif + +#ifdef DRIVE_TTY +void tty_ansicol_prep_attr(void); +void tty_ansicol_dump_attr(void); + +void tty_ansicol_init(void); +void tty_ansisys_init(void); +#endif + + #endif /* PWP_TTY_H */