Path: news.ccsf.jp!news.tomockey.net!1.us.feeder.erje.net!4.us.feeder.erje.net!3.eu.feeder.erje.net!feeder.erje.net!news.uzoreto.com!aioe.org!cW9FX9L6+QM80Ir055Ewxg.user.46.165.242.75.POSTED!not-for-mail From: Takanori Oshiro Newsgroups: fj.sources Subject: A program which converts xbm to pr150 format Date: Fri, 23 Jul 2021 20:53:42 +0900 Organization: Aioe.org NNTP Server Message-ID: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: gioia.aioe.org; logging-data="47244"; posting-host="cW9FX9L6+QM80Ir055Ewxg.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org"; User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) X-Notice: Filtered by postfilter v. 0.9.2 Cancel-Lock: sha1:+VYWbCfZStXCaZscSfMXieziNdE= Xref: news.ccsf.jp fj.sources:322 In order not to see graphic screen print picture file program becomes to be needed Because I do not know control code of USB printer I wrote program for NEC PC-PR150 This program is no error check Please refer to source code about detail #include #include #include #define ON 1 int main(argc,argv) int argc; char *argv[]; { FILE *fp; char c,d,e,f,g,h; char str[80]; int width,height; int i,j,k,l,m,n,o,p; char raster[5000][24]; unsigned char datum[60000]; unsigned char x; i=0; fp=fopen(*++argv,"r"); while((c=getc(fp)) != ' ') ; while((c=getc(fp)) != ' ') ; while((c=getc(fp)) != '\n') str[i++]=c; str[i]='\0'; width = atoi(str); i=0; while((c=getc(fp))!=' ') ; while((c=getc(fp))!=' ') ; while((c=getc(fp))!='\n') str[i++]=c; str[i]='\0'; height= atoi(str); i=0; while((c=getc(fp))!='{') ; while((c=getc(fp)) != '}'){ if(c == ' ' || c==',' || c=='\n') break; if(c == '0') c=getc(fp); if(c =='x') c=getc(fp); if(isdigit(c)){ d=c-48; d<<4; datum[i]=d; } else { d=toupper(c); d=d-56; d<<4; datum[i]=d; } c=getc(fp); if(isdigit(c)){ d=c-48; datum[i]+=d; } else { d=toupper(c); d-=56; datum[i]+=d; } i++; } j=width/8; k=width % 8; for(i=0;i> 1; } } } j = height / 24; k = height % 24; putchar(0x1c); putchar(0x64); putchar(0x33); putchar(0x32); putchar(0x30); putchar(0x2e); for(i=0;i<60000;i++) ; putchar(0x1b); putchar(0x54); putchar('0'); putchar('9'); for(i=0;i<60000;i++) ; e = height / 1000 + '0'; f = (height % 1000) / 100 + '0'; g = (height % 100) / 10 + '0'; h = height % 10 + '0'; for(i=0;i