From:	CRDGW2::CRDGW2::MRGATE::"SMTP::CRVAX.SRI.COM::RELAY-INFO-VAX" 14-AUG-1989 22:48
To:	MRGATE::"ARISIA::EVERHART"
Subj:	Banner Maker for VMS report (1/9)

Received: From KL.SRI.COM by CRVAX.SRI.COM with TCP; Mon, 14 AUG 89 19:15:15 PDT
Received: from ucbvax.Berkeley.EDU by KL.SRI.COM with TCP; Mon, 14 Aug 89 18:52:00 PDT
Received: by ucbvax.Berkeley.EDU (5.61/1.37)
	id AA05168; Mon, 14 Aug 89 18:37:05 -0700
Received: from USENET by ucbvax.Berkeley.EDU with netnews
	for info-vax@kl.sri.com (info-vax@kl.sri.com)
	(contact usenet@ucbvax.Berkeley.EDU if you have questions)
Date: 14 Aug 89 21:46:46 GMT
From: ecsvax!uncw!session@mcnc.org  (Zack Sessions)
Organization: UNC-Wilmington, Math&CS Dept
Subject: Banner Maker for VMS report (1/9)
Message-Id: <481@uncw.UUCP>
Sender: info-vax-request@kl.sri.com
To: info-vax@kl.sri.com

$! ------------------ CUT HERE -----------------------
$ v='f$verify(f$trnlnm("SHARE_VERIFY"))'
$!
$! This archive created by VMS_SHARE Version 7.1-004  3-AUG-1989
$!   On 14-AUG-1989 15:48:20.88   By user SESSIONS (Zack C. Sessions)
$!
$! This VMS_SHARE Written by:
$!    Andy Harper, Kings College London UK
$!
$! Acknowledgements to:
$!    James Gray       - Original VMS_SHARE
$!    Michael Bednarek - Original Concept and implementation
$!
$!+ THIS PACKAGE DISTRIBUTED IN 9 PARTS, TO KEEP EACH PART
$!  BELOW 30 BLOCKS
$!
$! TO UNPACK THIS SHARE FILE, CONCATENATE ALL PARTS IN ORDER
$! AND EXECUTE AS A COMMAND PROCEDURE  (  @name  )
$!
$! THE FOLLOWING FILE(S) WILL BE CREATED AFTER UNPACKING:
$!       1. BANNER.C;25
$!       2. README.BANNER;4
$!       3. STDFNT.H;8
$!
$set="set"
$set symbol/scope=(nolocal,noglobal)
$f=f$parse("SHARE_TEMP","SYS$SCRATCH:.TMP_"+f$getjpi("","PID"))
$e="write sys$error  ""%UNPACK"", "
$w="write sys$output ""%UNPACK"", "
$ if f$trnlnm("SHARE_LOG") then $ w = "!"
$ if f$getsyi("version") .ges. "V4.4" then $ goto START
$ e "-E-OLDVER, Must run at least VMS 4.4"
$ v=f$verify(v)
$ exit 44
$UNPACK: SUBROUTINE ! P1=filename, P2=checksum
$ if f$search(P1) .eqs. "" then $ goto file_absent
$ e "-W-EXISTS, File ''P1' exists. Skipped."
$ delete/nolog 'f'*
$ exit
$file_absent:
$ if f$parse(P1) .nes. "" then $ goto dirok
$ dn=f$parse(P1,,,"DIRECTORY")
$ w "-I-CREDIR, Creating directory ''dn'."
$ create/dir 'dn'
$ if $status then $ goto dirok
$ e "-E-CREDIRFAIL, Unable to create ''dn'. File skipped."
$ delete/nolog 'f'*
$ exit
$dirok:
$ w "-I-PROCESS, Processing file ''P1'."
$ define/user sys$output nl:
$ EDIT/TPU/NOSEC/NODIS/COM=SYS$INPUT 'f'/OUT='P1'
PROCEDURE Unpacker ON_ERROR ENDON_ERROR;SET(FACILITY_NAME,"UNPACK");SET(
SUCCESS,OFF);SET(INFORMATIONAL,OFF);f:=GET_INFO(COMMAND_LINE,"file_name");
buff:=CREATE_BUFFER(f,f);p:=SPAN(" ")@r&LINE_END;POSITION(BEGINNING_OF(buff))
;LOOP EXITIF SEARCH(p,FORWARD)=0;POSITION(r);ERASE(r);ENDLOOP;POSITION(
BEGINNING_OF(buff));g:=0;LOOP EXITIF MARK(NONE)=END_OF(buff);x:=
ERASE_CHARACTER(1);IF g = 0 THEN IF x="X" THEN MOVE_VERTICAL(1);ENDIF;IF x=
"V" THEN APPEND_LINE;MOVE_HORIZONTAL(-CURRENT_OFFSET);MOVE_VERTICAL(1);ENDIF;
IF x="+" THEN g:=1;ERASE_LINE;ENDIF;ELSE IF x="-" THEN g:=0;ENDIF;ERASE_LINE;
ENDIF;ENDLOOP;p:="`";POSITION(BEGINNING_OF(buff));LOOP r:=SEARCH(p,FORWARD);
EXITIF r=0;POSITION(r);ERASE(r);COPY_TEXT(ASCII(INT(ERASE_CHARACTER(3))));
ENDLOOP;o:=GET_INFO(COMMAND_LINE,"output_file");WRITE_FILE(buff,o);
ENDPROCEDURE;Unpacker;EXIT;
$ delete/nolog 'f'*
$ CHECKSUM 'P1'
$ IF CHECKSUM$CHECKSUM .eqs. P2 THEN $ EXIT
$ e "-E-CHKSMFAIL, Checksum of ''P1' failed."
$ ENDSUBROUTINE
$START:
$ create/nolog 'f'
X/*
X    banner.c
X    Version 2.1
X
X    Copyright (c) 1989
X    ColorSystems
X    Zack C. Sessions
X
X    Banner Maker program for OS9. Currently supports only
X    Tandy DMP style printers.
X
X`009NOTE: THIS VERSION HAS BEEN PORTED OVER TO VMS BY
X`009ZACK SESSIONS. IT CURRENTLY ONLY SUPPORTS A GE GENICOM
X`009PRINTER. YOU WILL ONLY HAVE TO MODIFY THE CONSTANTS
X`009cond AND norm TO SUPPORT OTHER PRINTERS. cond IS THE
X`009ESCAPE SEQUENCE REQUIRED TO SET THE PRINTER IN
X`009`12616.5 CPI AND 12 LPI, AND norm RESETS THE PRINTER
X`009TO 10 CPI AND 6 LPI.
X*/
X#include <unixio.h>
X#include <file.h>
X#include <stdio.h>
X#include "stdfnt.h"
X#define TRUE 1
X#define FALSE 0
X
X char *copyright`091`093 = `123"Banner.c Copyright (c) 1989 ",
X                      "by Zack C. Sessions"`125;
X
X char cond`091`093 = `12327,'`091','6','0',';','4','3',' ','G'`125;
X`009/* Condensed Print (16.7 cpi), Half line feed (12 lpi) */
X char norm`091`093 = `12327,'`091','1','2','0',';','7','2',' ','G'`125;
X        /* Normal print (10 cpi) Full Line feed (6 lpi) */
X
X FILE    *banner,    *fopen();
X
X char   newline = '\n';
X char   space = ' ';
X char   star;
X char   out;
X char   *cp;
X int    ret;
X int    font;
X char   fname`09130`093;
X char   line`091150`093;
X char   temp`0912`093;
X
Xvoid Bell()
X`123
X    fwrite("`007",1,1,stdout);
X`125
Xinterr(errnum)
X int    errnum;
X`123
X    fprintf(stderr,"\nInternal Error #%d. Please report.\n",errnum);
X    Bell();
X    exit(1);
X`125
Xabrt(num)
X int num;
X`123
X    fprintf(stderr,"\nBanner: Program abort - ");
X    switch (num) `123
X        case 1 :    fprintf(stderr,"No output file specified.");
X                    break;
X        case 2 :    fprintf(stderr,"No banner message specified.");
X                    break;
X        case 3 :    fprintf(stderr,"Cannot open output file.");
X                    break;
X        default:    interr(5);
X    `125
X    fprintf(stderr,"\n");
X    Bell();
X    exit(1);
X`125
Xvoid Clear()
X`123
X    fwrite("`027`0912J`027`091f",7,1,stdout); /* ANSI for Clear Screen
X                                             and Home Cursor */
X`125
Xprtlet(idx)
X int idx;
X`123
X    char    c;
X    char    *p;
X    char    offset;
X    char    onoff;
X    int     flag;
X    int     i;
X
X    fprintf(stderr,"%c",fntchar`091idx`093);
X    p = fnt;
X    p += fntindex`091idx`093;
X    offset = *p;
X    ++p;
X    c = *p;
X    ++p;
X    line`0910`093 = '\0';
X    temp`0910`093 = space;
X    for(i=0; i<offset; ++i)
X        strcat(line,temp);
X    flag = FALSE;
X    while(c!=100) `123
X        if((c>0)&&(c<99)) `123
X            onoff = *p;
X            ++p;
X        `125
X        if(c == 99)
X            fputs(line,banner);
X        else `123
X            if(c == 0) `123
X                temp`0910`093 = newline;
X                strcat(line,temp);
X                fputs(line,banner);
X                flag = TRUE;
X            `125
X            else `123
X                if(flag) `123
X                    flag = FALSE;
X                    line`0910`093 = '\0';
X                    temp`0910`093 = space;
X                    for(i=0; i<offset; ++i)
X                        strcat(line,temp);
X                `125
X                for(i=0; i<c; ++i) `123
X                    if(onoff) `123
X                        temp`0910`093 = star;
X                        strcat(line,temp);
X                    `125
X                    else `123
X                        temp`0910`093 = space;
X                        strcat(line,temp);
X                    `125
X                `125
X            `125
X        `125
X        c = *p;
X        ++p;
X    `125
X`125
X
Xmain(argc,argv)
X int argc;
X char *argv`091`093;
X`123
X    char    c;
X    int     i;
X    char    msg`09181`093;
X    char    ifile`09165`093;
X    int     again = TRUE;
X
X    star = '*';
X    if(argc > 1) `123
X        ++argv;
X        --argc;
X        if(**argv == '?') `123
X            printf("\nUsage: banner `091opt`093 `091filename`093\n\n");
X            printf("`091opt`093 = ?, display this message\n");
X            printf("      = -c\"=x\", specifies x as alternate banner charac
Vter\n\n");
X            exit(0);
X        `125
X        else
X            if(**argv == '-') `123
X                cp = *argv;
X                ++argv;
X                ++cp;
X                if((*cp == 'c')`124`124(*cp == 'C')) `123
X                    ++cp;
X                    if(*cp == '=') `123
X                        ++cp;
X                        if(*cp == '\"') `123
X                            ++cp;
X                            star = *cp;
X                        `125
X                        else ;
X                    `125
X                    else ;
X                `125
X                else ;
X            `125
X    `125
X    temp`0911`093 = '\0';
X    Clear();
X    fprintf(stderr,"Welcome to Banner Maker for VMS V2.1\n\n");
X    fprintf(stderr,"Copyright (c) 1989\n\n");
X    fprintf(stderr,"by Zack C. Sessions\n\n");
X    Bell();
X    while(again) `123
X        fprintf(stderr,"Output Filename? ");
X`009if(gets(fname) == NULL)
X            abrt(1);
X        fprintf(stderr,"\nI know about the following characters:\n\n");
X        for(i=0; i<CHARACTERCOUNT; ++i)
X            fprintf(stderr,"%c ",fntchar`091i`093);
X        fprintf(stderr,"\n\nEnter banner message below\n\n-> ");
X`009if(gets(msg) == NULL)
X            abrt(2);
X        if((banner = fopen(fname,"w")) == NULL)
X            abrt(3);
X        fwrite(cond,9,1,banner);
X        fprintf(stderr,"   ");
X        temp`0910`093 = newline;
X        for(i=0; i<18; ++i)
X           fputs(temp,banner);
X        for(cp = msg; *cp!='\0'; ++cp) `123
X            if(*cp != '\n') `123
X                if(*cp == ' ') `123
X                    fprintf(stderr," ");
X                    temp`0910`093 = newline;
X                    for(i=0; i<35; ++i)
X                        fputs(temp,banner);
X                `125
X                else `123
X                    for(i=0; (i<CHARACTERCOUNT)&&(fntchar`091i`093!=*cp); ++
Vi) ;
X                    if(i==CHARACTERCOUNT)
X                        fprintf(stderr,"\nCharacter %c not found in index!\n
V",*cp);
X                    else `123
X                        prtlet(i);
X                        temp`0910`093 = newline;
X                        for(i=0; i<6; ++i)
X                            fputs(temp,banner);
X                    `125
X                `125
X            `125
X        `125
X        fwrite(norm,10,1,banner);
X        fwrite("\f",1,1,banner);
X        fclose(banner);
X        fprintf(stderr,"\n\nAnother banner? ");
X`009gets(msg);
X        if((msg`0910`093=='N')`124`124(msg`0910`093=='n')`124`124(i<=1))
X            again = FALSE;
X        else
X            fprintf(stderr,"\n\n");
X    `125
X`125
$ CALL UNPACK BANNER.C;25 1479235204
$ create/nolog 'f'
XBanner Maker for VMS
XVersion 2.1
XAugust 10, 1989
X
XCopyright (c) 1989
Xby Zack C. Sessions
X
XNOTE: This release fixes the "multiple symbol definition" for
XABORT with V3.0 of VAX C.
X
X
XYou have gotten youself one fine program, now!! I originally
Xwrote Banner Maker for my CoCo 3 (Color Computer 3) under the
XOS9 Level 2 Operating System. Since I wrote it in C using fairly
Xtransportable code, it easily ported  over to VMS. In the original
Xdesign for my CoCo, I used an external binary file to define the
X"font" or design of each character in it's character set. I also
Xhad an index file which had a pointer into the font file for each
Xcharacter.
X
XIn my original port to VMS, I maintained it's design respective
Xto the external font and index file. I had numerous requests
Xfrom other VMS users through the Internet VMS Newsgroup, and since
Xthe most popular method of posting stuff was using VMS_SHARE,
XI had a problem with the binary format of the font file.
X
XSo I went back to work on it. I wrote a quickie which read in the
Xbinary font file and wrote out a an ASCII file which defined the
Xconstants for a superhuge character string array. Then after a
Xfew hours of editing and testing, I was satisfied.
X
XSo this version does require a C compiler, I used the DEC VAX-C
XCompiler, Version 2.3 and VMS Version 5.0-2. On my 8300 it
Xtakes almost 4 minutes just to compile the program! Just a standard
Xcompile ane link should do it.
X
X$ cc banner.c
X$ link banner,sys$input:/opt
Xsys$share:vaxcrtl/share
X`094Z
X
Xps, make sure the include file, stdfnt.h is in your current default
Xdirectory to compile it.
X
XDue to the design of this font, the banners look much better when
Xprinted at 12 Lines Per Inch Vertically and 16.7 Characters Per Inch
XHorizontally. The program as is automatically includes the escape
Xsequences in the banner file to set these characteristics and then
Xto reset them at the end to 6 Lines Per Inch and 10 Characters Per
XInch. These escape sequences work ONLY with a GE GENICOM printer.
XTo support your printer, modify the definition of the variables,
X"norm" and "cond" appropriately.
X
XOh, yes, if you study the program and the stdfnt.h file, you will
Xsee that it uses a very simple algorithm, and you can design your
Xown fonts with just a little work. The hardest part is designing
Xthe characters. Then transcribe them into the fnt character string.
XRe-compile the program with you include file and there you have it.
X
XHave fun!
X
XZack Sessions
XGeneral Electric
XNuclear Fuels & Component Manufacturing
XWilmington, NC
X(919) 675-5517 (Work)
$ CALL UNPACK README.BANNER;4 928875426
$ create/nolog 'f'
X#define FONTSIZE 22169
X#define CHARACTERCOUNT 90
X
X char fntchar`091CHARACTERCOUNT`093 = `123
X 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
X 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b',
X 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p',
X 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '1', '2', '3', '4',
X '5', '6', '7', '8', '9', '0', '!', '\"', '#', '$', '%', '&', '\'', '(',
X ')', ':', '*', '-', '=', '@', ';', '+', ',', '.', '/', '<', '>', '?',
X '`124', '`126', '`091', '`093', '_', '\\'`125;
X
X int fntindex`091CHARACTERCOUNT`093 = `123
X 0, 353, 595, 936, 1189, 1392, 1613, 2021, 2288, 2391, 2585, 3027, 3167,
X 3533, 3886, 4248, 4486, 4966, 5291, 5761, 5964, 6297, 6675, 7178, 7673,
X 8012, 8424, 8754, 8999, 9226, 9469, 9779, 9956, 10457, 10639, 10737,
X 10879, 11145, 11207, 11505, 11687, 11909, 12166, 12423, 12571, 12868,
X 13006, 13180, 13438, 13795, 14143, 14478, 14741, 14834, 15202, 15590,
X 15849, 16228, 16639, 16861, 17268, 17681, 17994, 18071, 18148, 18490,
X 18852, 19120, 19581, 19618, 19741, 19864, 19931, 20283, 20325, 20371,
X 20863, 20948, 20998, 21044, 21081, 21213, 21444, 21668, 21927, 21941,
X 21943, 21966, 21989, 22037`125;
X
X char fnt`091FONTSIZE`093 = `123
X  25,   6,   1,   0,  99,  99,   7,   1,   0,  99,   8,   1,   0,   9,   1,
X   0,  11,   1,   0,  13,   1,   0,  15,   1,   0,  17,   1,   0,  20,   1,
X   0,  23,   1,   0,  26,   1,   0,  29,   1,   0,  10,   1,   7,   0,  15,
X   1,   0,   8,   1,  13,   0,  14,   1,   0,   7,   1,  18,   0,  14,   1,
X   0,   7,   1,  20,   0,  15,   1,   0,   6,   1,  22,   0,  17,   1,   0,
X   6,   1,  22,   0,  20,   1,   0,   6,   1,  22,   0,   6,   1,   2,   0,
X  15,   1,   0,   6,   1,  22,   0,   6,   1,   6,   0,  14,   1,   0,  28,
X   0,   6,   1,   9,   0,  14,   1,   0,  28,   0,   6,   1,  12,   0,  14,
X   1,   0,  28,   0,   6,   1,  15,   0,  14,   1,   0,  28,   0,   6,   1,
X  18,   0,  14,   1,   0,  28,   0,   6,   1,  21,   0,  14,   1,   0,  28,
X   0,   6,   1,  24,   0,  14,   1,   0,  28,   0,   6,   1,  27,   0,  14,
+-+-+-+-+-+-+-+-  END  OF PART 1 +-+-+-+-+-+-+-+-


Zack Sessions                          | Utilizing the computing facilities
General Electric                       | at the University of North Carolina 
Nuclear Fuels & Component Manufacturing| at Wilmington 
Wilmington, NC                         |
(919) 675-5517                         |

"If it ain't broke, then don't fix it!"

