Article 92 of unix-pc.sources: Path: tut.cis.ohio-state.edu!mailrus!ames!killer!loci From: loci@killer.UUCP (loci!clb) Newsgroups: unix-pc.sources Subject: loci vsee/vsav shar Keywords: PC7300 pix xfer Message-ID: <3906@killer.UUCP> Date: 23 Apr 88 06:31:54 GMT Organization: The Unix(R) Connection, Dallas, Texas Lines: 392 I've been quite gratified by the response to my recent posting regarding programs I've written. Thanks to all of you. This package is the program pair "vsee" and "vsav", which seems to be the most popular. Have fun. charles brunow (loci!clb) #_______________cut_line______________ #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh disclaim <<'END_OF_disclaim' X X Enclosed are two very simple routines, "vsav" and "vsee". X Before I go any further, let me add this disclaimer: X X These programs should be considered as a starting point. X The compaction scheme is a simple repeated byte X method like that used for MacPaint files. At this X time, uuencoding is required for mailers to handle X the picture files correctly. Future revisions, if any X will change these methods, but conversion should X be easily accomplished so "pix" files will not X be rendered obsolete. X X The concept of these programs is to establish an efficient X method of transmitting PC7300 pixel images in a compatible way X to email or news. These programs do not have any facilities X for creating the "picture", but merely to capture it via X an ioctl() call and packaging it for transmission, and X decode and display said files. X X If sufficient interest exists for such a system, additional X versions will be created with more features. High on my X list of updates is a built-in "(LZ) compress-uuencode" function X which will create a mailer-ready file in one go. All interested X parties are invited to submit suggestions, ideas, code, etc. X and I will attempt to maintain a degree of organization to X the effort. However, if little or no interest is expressed, X the whole project will end at this point. X X The usage of the program "vsav" is as follows: get the screen X display the way you want it and enter "vsav [file-name]". X I enclose a sample pix which was made by entering: X "plotter;vsav dino". This calls up my plotter routine, lets me create X my pix, and then saves it. Then I uue'd it. Viewing is done by X "vsee dino" (after it's uud'd). X X I sincerely hope that this scheme sparks wide interest, even if X the PC7300 is an obsolete machine %-( X X charles brunow X {csccat | killer | rpp386}!loci!clb X X END_OF_disclaim if test 1825 -ne `wc -c vsav.c <<'END_OF_vsav.c' X#include X#include X#include X#include X#include X X#define ADDR_URDATA 400L X Xstatic char version[] = { "@(#)vsav.c 1.4: loci!clb 1988" }; X Xint fd; Xunsigned short mypix[348][45]; Xchar bfr[512] = {"# ************\n\nThis is a packed 7300 screen file\ncompatible with the program \"vsho\", by loci!clb\ndata starts at byte 512.\n\n\n\n" }; Xchar *progname; Xchar filename[80], padding[32]; Xstruct urdata proto = X{ 0,90, 0,0, 0,0, 0,0, 720, 288, 0, }; X Xmain(ac, av) Xint ac; Xchar *av[]; X{ X char *p, *pp; X int i, max, len; X X progname = av[0]; X fd = open("/dev/window", O_RDONLY); X if(fd < 0) err(1); X i = ioctl(fd, WIOCREAD, mypix); if(i < 0) err(4); X close(fd); X if(ac == 2) X { X strcpy(filename, av[1]); X strcat(filename, ":V"); X } else strcpy(filename, "pix:V"); X fd = creat(filename, 0644); X if(fd < 0) err(2); X X p = (char *)(&proto); X pp = &bfr[ADDR_URDATA]; X for(i=0; i 0) X { X s_cnt = (max > 128) ? 128 : max; X max -= s_cnt; X while(s_cnt > 0) X { X if(i = group(p, s_cnt)) X { X s_cnt -= i; X cnt = i - 1; X write(ofd, &cnt, 1); X write(ofd, p, i); X p += i; X } X if(i = repeated(p, s_cnt)) X { X s_cnt -= i; X cnt = 1 - i; X write(ofd, &cnt, 1); X write(ofd, p, 1); X p += i; X } X } X } X} X Xgroup(p, max) Xchar *p; X{ X register m_cnt; X register char c; X int i; X X m_cnt = 1; X for(i=0; i 2) X { X --i; --i; X break; X } X } X return(i); X} X Xrepeated(p, max) Xchar *p; X{ X int cnt; X char c; X X c = *p++; X for(cnt=1; cntvsee.c <<'END_OF_vsee.c' X#include X#include X#include X#include X X#define ADDR_URDATA 400L X Xstatic char version[] = { "@(#)vsee.c 1.6: loci!clb 1988" }; Xchar filename[80]; Xunsigned short mypix[348][45]; Xint wd, fd; Xstruct urdata proto, data = X{ X mypix, 90, 0, 0, 0, 12, 0, 0, 720, 288, SRCSRC, DSTSRC, 0 X}; X Xmain(ac, av) Xint ac; Xchar *av[]; X{ X int i, j, k; X char *p; X X if(ac < 2) X { X fprintf(stderr, "usage: %s image_file ...\n", av[0]); X exit(1); X } X wd = 0; X for(j=1; j 0) X { X if(read(fd, &c_data, 1) != 1) X return(-1); X if(c_data & bit7) /* High bit set ? */ X { X nbytes = -(c_data); X cnt -= ++nbytes; X if(read(fd, &r_data, 1) != 1) X return(-1); X while(nbytes--) X *dst_p++ = r_data; /* repeat src byte */ X } else { /* It is a normal zero based counter */ X nbytes = c_data; X cnt -= ++nbytes; X if(read(fd, dst_p, nbytes) < nbytes) X return(-1); X dst_p += nbytes; X } X } X return(0); X} X END_OF_vsee.c if test 1761 -ne `wc -c dino.uue <<'END_OF_dino.uue' Xbegin 644 dino:V XM(R`J*BHJ*BHJ*BHJ*BH*"E1H:7,@:7,@82!P86-K960@-S,P,"!S8W)E96X@ XM9FEL90IC;VUP871I8FQE('=I=&@@=&AE('!R;V=R86T@(G9S:&\B+"!B>2!L XM;V-I(6-L8@ID871A('-T87)T71E(#4Q,BX*"@H*```````````` XM```````````````````````````````````````````````````````````` XM```````````````````````````````````````````````````````````` XM```````````````````````````````````````````````````````````` XM```````````````````````````````````````````````````````````` XM```````````````````````````````````````````````````````````` XM```````````````````````````````````````````````````````````` XM6@```````````````````M`!(``````````````````````````````````` XM```````````````````````````````````````````````````````````` XM``````````````````````"G`*<`IP"G``$`_*D``0#&J0`!`,:I``$`QJD` XM`0#FJ0`!`-RI``$`P*D``0#`J0"G`*<`IP"G`*<`IP"G`*<`IP"G`*<`IP"G XM`*<`IP"G`*<`IP"G`*<`IP"G`*<`IP"G`*<`IP"G`*<`IP"G`*<`IP"G`*<` XMIP"G`*<`IP"G`*<`IP"G`*<`IP"G`*<`IP"G`*<`IP"G`*<`IP"G`*<`IP"G XM`*<`IP"G`*<`IP"G`*<`IP"G`*<`IP"G`*<`IP"G`*<`IP"G`*<`IP"G`*<` XMIP"G`*<`IP"G`*<`IP"G`*<`IP"G`*<`IP"G`*<`IP"G`*<`IP"G`*<`IP"G XM`*<`IP"G`*<`IP"G`*<`IP"G`*<`IP"G`*<`IP"G`*<`IP"G`*<`IP#%``/_ XMP``?YP#$``+P`&#G`,0``C@`8.<`Q``"!P`8YP#'``7``/`#``_G`,<``N`` XM#N0`QP`#'``'@.4`QP`##P`!P.4`QP`#`X``\.4`Q@`"<``XY0#&``(\`![E XM`,8``@X`!^4`SP``\/P`!<``P`$``^4`SP`(O@``/P``\`#@X@#/``@'``_@ XM```X`'CB`,X`!^#X```#!\`#C`-$``^``!@'Z``!PXP#1``9P`!@```!@_0`` XM/.,`T0`&/``8````?OT```[C`-$`"PX`,`````?`@```!^,`T0`"-@`P_0`$ XM.,````'C`-$``F&`P/T``1[PX`#1``B!P,`!````!SC@`-``!_"``\`!``,> XMX`#0```\&`8``>.$`UP`$C````_C]``9@#`;A XMP``/X0#7``3F```!'/T`!L`,!G_P``SA`-<`#V8`@``#_P```\`,!@'X``SA XM`-<`#V&`_\```0```P`/A@88``SA`-<``X>``'_\``;`''X,!@`8X0#7```& XM_``)_```_QAF,`8`&.$`UP``?/P`"0?P`,`89G`&`!CA`-<`#^````/````_ XM`,`89F`&`&#A`-0`#!__````@,`88>`&`&'A`-4`#?_@`_\``(#`8&&`'@!C XMX0#/``>`8&!A`!@`8^$`SP`'@&!@80`8`&_A`,\`!\#`8&`!\`#,X0#/``?` XMP&!@`8`##.$`SP`'_\#@?P'_`_SA`*<`IP"G`*<`IP"G`*<`IP"G`*<`IP"G XM`*<`IP"G`*<`IP"G`-,``^````/9`-,``WP``#[9`-,``P.`!\#9`-(``G`- XM\-D`UP`&X```#P`./-@`UP`&/X#_^``!,-@`U@``P/T``3_PV0#6```P_``` XM,-D`V0`)P```'P``X``'_]D`V0`&_``/@```&-8`V0`&`^`P````#-8`V``& XM?&`````/!M<`VP`)@```#X````$#YM<`VP`)\````8`P``$`-M<`VP`)'^`` XM`(`8``,`-M<`WP`->`"```!_````&(`#`&_7`-\``^``?__\``0P^`,`;]<` XMWP`#P````_P`!/^>#`/WUP#=``O__@!__^`!@//\`WS7`-L`"?_``#\!@,#L XM`;W7`-<`!0'`PPP`!M<`U@`$P,,#``'7`-<`!8`P@P,``=<`UP`%@#"#`0`! XMUP#7``5@P`8```;7`-<`!7#`'@``#M<`UP`%,8`X```,UP#7``4Q@#```##7 XM`-<`!3&`P```<-<`UP`%[X#P#P!GUP#7``7Q@#`?`?S7`-8``\`8&`/6`*<` XMIP"G`*<`IP"G`*<`IP"G`*<`IP"G`*<`IP"G`*<`IP"G`*<`IP"G`*<`IP"G XM`*<`IP"G`*<`IP"G`*<`IP"G`*<`IP"G`*<`IP"G`*<`IP"G`*<`IP"G`*<` X6IP"G`*<`IP"G`*<`IP"G`*<`IP"G``"G X` Xend END_OF_dino.uue if test 2785 -ne `wc -c