v10i066: Cassette cover printing program, part 1
Remco Bruyne
remco at tnoibbc.ibbc.tno.nl
Wed Feb 14 13:03:56 AEST 1990
Posting-number: Volume 10, Issue 66
Submitted-by: remco at tnoibbc.ibbc.tno.nl (Remco Bruyne)
Archive-name: c_cover/part01
Hello,
This is a (yet another) program for printing cassette cartridge
covers. The output is in the form of a postscript file. The program
is written in C and should run on (almost) all machines supporting
C and some simple stdio functions. I tested it on Atari ST (MWC) and
several different UNIX systems.
The layout of the output can be changed by editing a configuration
file (extensive documentation included!). It should even be simple
to make CD cartridge covers.
I made TWO shar files which both have to be unpacked separately.
The second one follows.
Remco
--------------cut here------------
#!/bin/sh
# This is a shell archive. Remove anything before above line,
# then unpack it by saving it in a file and typing "sh file".
# - Files are being checked using wc. When an error has been found a
# message will be generated.
# - Files already existing will not be overwritten. The new file will
# be given anothe random name. A message will then be generated.
# - The exact protections of the files being shared are maintained.
# Before sharing the file protections are saved and restored when
# unshared.
#
# Shar file created : Wed Feb 7 15:37:01 MET 1990
# Shar file contains : c_cover.c catalog.c creat.c data.c defines.h del.c edit.c list.c menu.c mktmp.c new_it.c output.c params.c
#
echo x - c_cover.c
if test -f c_cover.c
then
echo c_cover.c exists, putting output in $$c_cover.c
OUT=$$c_cover.c
else
OUT=c_cover.c
fi
sed 's/^X//' > $OUT <<'@//E*O*F c_cover.c //'
X#include "defines.h"
X#include "xdefs.h"
X
X/*----------------------------------*\
X | Program to create cassettecovers |
X | via interactive menus. |
X | Put TABs in every 4th position |
X | vi: ':set ts=4<CR>' |
X | |
X | Remco Bruyne |
X\*----------------------------------*/
X
Xextern void StartMesg();
Xextern void Clearup();
Xextern void ReadCatalog();
Xextern void CreatCover();
Xextern void DelCovers();
Xextern void EditCover();
Xextern void InitMenu();
Xextern void OutCovers();
Xextern void ReadACover();
Xextern void ShowCover();
X
X
Xmain()
X{
X /*
X * Init menus. This is for counting the number of items
X */
X InitMenu(&MainMenu);
X InitMenu(&TapeMenu);
X InitMenu(&NoiseMenu);
X InitParams();
X
X#ifdef ATARI
X ClearScreen();
X#endif /* ATARI */
X ClearScreen();
X StartMesg();
X
X ReadCatalog();
X
X while(1) {
X switch(ChooseMenu(&MainMenu)) {
X case LIST_COVERS:
X if(NCatItems == 0) {
X Attention("There are no covers available yet");
X continue;
X }
X ListCovers(ALL);
X RetCont();
X break;
X
X case DEL_COVERS:
X if(NCatItems == 0) {
X Attention("There are no covers available yet");
X continue;
X }
X DelCovers();
X break;
X
X case CREAT_COVER:
X CreatCover();
X break;
X
X case RD_COVER:
X ReadACover();
X break;
X
X case EDIT_COVER:
X EditCover();
X SaveCover(CurIt, CurCass);
X SaveCatalog();
X break;
X
X case SHO_COVER:
X ShowCover();
X break;
X
X case FILE_COVER:
X if(NCatItems == 0) {
X Attention("There are no covers available yet");
X continue;
X }
X OutCovers(TO_FILE);
X break;
X
X case QUIT:
X Clearup();
X return(0);
X }
X }
X}
X
X
X
Xvoid
XClearup()
X{
X SaveCatalog();
X return;
X}
X
X
X
Xvoid
XStartMesg()
X{
Xprintf(" *-------------------------------------*\n");
Xprintf(" | |\n");
Xprintf(" | CASSCOVER |\n");
Xprintf(" | |\n");
Xprintf(" *-------------------------------------*\n\n");
X
Xprintf(" A PROGRAM FOR MAKING CASSETTE TAPE COVERS\n\n");
X
Xprintf(" by R.M. Bruijne ..\n");
XNLines((SCRLINES-9)/2 - 4);
Xprintf(" This is a PUBLIC DOMAIN program!\n\n\n\n");
XRetCont();
X
XNLines(SCRLINES-8);
Xprintf("CASSCOVER may be copied freely, but NOT for commercial purposes.\n\n");
X
Xprintf("This program runs under all versions of UN*X, under VAX/VMS, on\n");
Xprintf("all MS-DOS machines, on ATARI ST and on some other systems.\n\n");
X
Xprintf("There are no known bugs as yet (jan 1990),but when you find any,\n");
Xprintf("please report them to the author: remco at tnoibbc.ibbc.tno.nl.\n\n");
X
Xprintf("The file CASSETTE.DAT is a configuration file. In this file you\n");
Xprintf("find the fonts, character sizes and the positioning of all texts\n");
Xprintf("and separation lines. See also the supplied documentation.\n\n");
X
XNLines(SCRLINES-17);
XRetCont();
Xreturn;
X}
@//E*O*F c_cover.c //
chars=`wc -c < c_cover.c | awk '{ print $1}'`
if test $chars != 2893
then
echo 'c_cover.c' is $chars characters,
echo should be 2893 characters\!
else
chmod u=rw-,g=r--,o=r-- $OUT
fi
echo x - catalog.c
if test -f catalog.c
then
echo catalog.c exists, putting output in $$catalog.c
OUT=$$catalog.c
else
OUT=catalog.c
fi
sed 's/^X//' > $OUT <<'@//E*O*F catalog.c //'
X#include <stdio.h>
X#include "xdefs.h"
X
X#define LINELEN 80
X#define CONTMAGIC "#X-CASS-CATALOG"
X
X
Xextern CATITEM *NewCatItem();
X
X
X
Xstatic char *CassCatalog = "CATALOG.CAS";
X
Xvoid
XReadCatalog()
X{
X FILE *Fp;
X CATITEM *TmpIt;
X int LineNum;
X
X if((Fp = fopen(CassCatalog, "r")) == NULL) {
X /*
X * Catalog file is not there, so no covers are saved yet
X */
X return;
X }
X
X LineNum = 0;
X if(CheckMagic(Fp) == -1)
X return;
X
X LineNum++;
X
X while(1) {
X
X /*
X * Read filename of cassettecover
X */
X if(fgets(LineBuf, LINELEN-1, Fp) == NULL) {
X /*
X * No more lines
X */
X fclose(Fp);
X return;
X }
X
X TmpIt = NewCatItem();
X LineNum++;
X NullEnd(LineBuf, LINELEN-1);
X
X /*
X * Check if legal line
X */
X if(StringNDiff("#F", LineBuf, 2)) {
X Panic("'#F' expected in catalogue file %s, on line %d",
X CassCatalog, LineNum);
X }
X TmpIt->FileName = NewString(LineBuf+2); /* +2: skip #F */
X
X
X /*
X * Read descriptionline of cassettecover
X */
X if(fgets(LineBuf, LINELEN-1, Fp) == NULL) {
X Panic("'#D' expected in catalogue file %s, after line %d\n",
X CassCatalog, LineNum);
X }
X LineNum++;
X NullEnd(LineBuf, LINELEN-1);
X
X /*
X * Check if legal line
X */
X if(StringNDiff("#D", LineBuf, 2)) {
X Panic("'#D' expected in catalogue file %s, line %d",
X CassCatalog, LineNum);
X }
X TmpIt->Description = NewString(LineBuf+2); /* skip #D */
X
X AddCatItem(TmpIt);
X }
X}
X
X
X
X
Xvoid
XSaveCatalog()
X{
X FILE *Fp;
X CATITEM *It;
X
X if((Fp = fopen(CassCatalog, "w")) == NULL) {
X /*
X * Catalog file is not there, so no covers are saved yet
X */
X Panic("Can't write catalogue file %s");
X }
X
X fprintf(Fp, "%s\n", CONTMAGIC);
X
X for(It = FirstCatIt; It != (CATITEM *)0; It = It->Next) {
X fprintf(Fp, "#F%s\n", It->FileName);
X fprintf(Fp, "#D%s\n", It->Description);
X }
X fclose(Fp);
X return;
X}
X
X
X
X
X
X
X
X/*------------------------------------------------------*\
X | Check if a magic string is in the catalog file |
X\*------------------------------------------------------*/
XCheckMagic(Fp)
XFILE *Fp;
X{
X
X /*
X * Read magic of this file
X */
X if(fgets(LineBuf, LINELEN-1, Fp) == NULL) {
X /*
X * No information in this file
X */
X fclose(Fp);
X return(-1);
X }
X
X NullEnd(LineBuf, LINELEN-1);
X
X if(StringDiff(LineBuf, CONTMAGIC)) {
X fclose(Fp);
X Panic("File %s is not a cover catalogue file!", CassCatalog);
X }
X return(0);
X}
X
X
X
X
X
X
X/*----------------------------------------------*\
X | Add a catalog item at the end of the list |
X\*----------------------------------------------*/
Xvoid
XAddCatItem(It)
XCATITEM *It;
X{
X It->Next = (CATITEM *)0; /* It always added at the end */
X It->Status = (flag)0;
X
X /*
X * Is it the first item ?
X */
X if(FirstCatIt == (CATITEM *)0) {
X FirstCatIt = It;
X LastCatIt = It;
X NCatItems = 1;
X return;
X }
X
X /*
X * Insert It at the end of the list
X */
X if(LastCatIt == (CATITEM *)0) {
X Panic("LastCatIt == 0");
X }
X LastCatIt->Next = It;
X LastCatIt = It;
X NCatItems++;
X return;
X}
@//E*O*F catalog.c //
chars=`wc -c < catalog.c | awk '{ print $1}'`
if test $chars != 2938
then
echo 'catalog.c' is $chars characters,
echo should be 2938 characters\!
else
chmod u=rw-,g=r--,o=r-- $OUT
fi
echo x - creat.c
if test -f creat.c
then
echo creat.c exists, putting output in $$creat.c
OUT=$$creat.c
else
OUT=creat.c
fi
sed 's/^X//' > $OUT <<'@//E*O*F creat.c //'
X#include <stdio.h>
X#include "xdefs.h"
X#include "defines.h"
X
X
Xextern void InSongs();
Xextern void MkTmp();
X
Xvoid
XCreatCover()
X{
X int CountsWanted = 0;
X
X ClearCurr();
X
X CurIt = NewCatItem();
X /*
X * define a filename for this cover
X */
X MkTmp(Buf);
X CurIt->FileName = NewString(Buf);
X CurIt->Description = (char *)0; /* CurIt was created with malloc() */
X /*
X * Let char pointers point to empty string
X */
X CurCass->BackCode = (char *)0;
X CurCass->BackTl1 = (char *)0;
X CurCass->BackTl2 = (char *)0;
X CurCass->Side1 = (SONG *)0;
X CurCass->Side2 = (SONG *)0;
X
X InDescription(CurIt);
X InTapeType();
X InNoiseRed();
X InBackCode();
X InBackTitle(1, &(CurCass->BackTl1));
X InBackTitle(2, &(CurCass->BackTl2));
X
X /*
X * Start inputting songs
X */
X CountsWanted = AskIfCountsWanted(1);
X InSongs(1, CountsWanted, &(CurCass->Side1));
X
X CountsWanted = AskIfCountsWanted(2);
X InSongs(2, CountsWanted, &(CurCass->Side2));
X
X /*
X * We now entered an entire cassette, so
X * insert into the catalog and store the cover info in file
X */
X SaveCover(CurIt, CurCass);
X AddCatItem(CurIt);
X SaveCatalog();
X return;
X}
X
X
X
Xvoid
XInDescription(It)
XCATITEM *It;
X{
X NLines(SCRLINES - 10);
X printf(" With which text may this cover be saved ?\n");
X NLines(1);
X printf(" This text is shown in the catalogue of\n");
X NLines(1);
X printf(" cassette covers.\n");
X NLines(1);
X printf(" It may not be longer than 60 characters:\n");
X NLines(3);
X printf(" ............................................................|\n");
X printf(" Text: "); fflush(stdout);
X
X gets(Buf);
X NullEnd(Buf, 60);
X
X if(Buf[0] == '\0') {
X StringCopy("There is no describing text with this cover", Buf);
X }
X
X if(It->Description != (char *)0) /* In case we are editing ... */
X free(It->Description);
X
X It->Description = NewString(Buf);
X return;
X}
X
X
X
Xvoid
XInTapeType()
X{
X int TChoice;
X
X TChoice = ChooseMenu(&TapeMenu);
X switch(TChoice) {
X case FEO3:
X case CRO2:
X case FECR:
X case METAL:
X CurCass->TapeType = TChoice;
X break;
X default:
X CurCass->TapeType = NONE;
X break;
X }
X return;
X}
X
X
X
Xvoid
XInNoiseRed()
X{
X int NChoice;
X
X
X NChoice = ChooseMenu(&NoiseMenu);
X
X switch(NChoice) {
X case DOLBY_B:
X case DOLBY_C:
X case DBX:
X case HXPRO:
X case NO_NR:
X CurCass->NoiseReduction = NChoice;
X break;
X default:
X CurCass->TapeType = NO_NR;
X break;
X }
X return;
X}
X
X
X
Xvoid
XInBackCode()
X{
X NLines(SCRLINES - 8);
X printf(" Which code do you want to have printed on the back of\n");
X NLines(1);
X printf(" the cover ? It may not be longer than %d characters :\n", CodeLen);
X NLines(4);
X printf(" Back-code: "); fflush(stdout);
X
X gets(Buf);
X NullEnd(Buf, CodeLen);
X /*
X * When we are editing an exisiting cover,
X * free the previous string
X */
X if(CurCass->BackCode != (char *)0)
X free(CurCass->BackCode);
X CurCass->BackCode = NewString(Buf);
X return;
X}
X
X
X
XInBackTitle(Num, BackTl)
Xint Num;
Xchar **BackTl;
X{
X int i;
X
X NLines(SCRLINES - 10);
X printf(" Which text do you want to have printed on the back of\n");
X NLines(1);
X printf(" the cover for side %d ?\n", Num);
X NLines(1);
X printf(" This text may not be longer than %d characters:\n", BTLen);
X NLines(3);
X printf(" ");
X for(i = 0; i < BTLen; i++)
X printf(".");
X printf("\n");
X
X printf(" Text: "); fflush(stdout);
X
X gets(Buf);
X NullEnd(Buf, BTLen);
X /*
X * If there is an exisiting backtitle, free it.
X */
X if(*BackTl != (char *)0)
X free(*BackTl);
X *BackTl = NewString(Buf);
X return;
X}
X
X
X
X
XAskIfCountsWanted(Side)
Xint Side;
X{
X printf("\n\n Do you wish to use counter tape numbers for side %d ? (y/n)..",
X Side);
X fflush(stdout);
X return(Confirm());
X}
X
X
X
X
X
X
Xvoid
XInSongs(Side, CountsWanted, SongP)
Xint Side;
Xint CountsWanted;
XSONG **SongP;
X{
X char CountBuf[10];
X int TCount;
X SONG *New;
X SONG *Curr;
X
X NLines(SCRLINES-14);
X printf(" Now enter the titles of side %d; hit RETURN when all\n", Side);
X NLines(1);
X printf(" titles of side %d have been entered.\n", Side);
X NLines(1);
X printf(" When there is an error in a title, or you forgot one, just\n");
X NLines(1);
X printf(" continue and later call the EDIT function from the main menu\n");
X NLines(3);
X
X TCount = 1;
X
X while(1) {
X if(CountsWanted) {
X printf(" Tape counter reading of title number %d (max %d characters): ",
X TCount, CtLen);
X fflush(stdout);
X gets(CountBuf);
X NullEnd(CountBuf, CtLen);
X
X if(CountBuf[0] == '\0') /* prev was last song */
X return;
X
X }
X printf(" Name of title %2d (max %d chars): ", TCount, TlLen);
X fflush(stdout);
X gets(Buf);
X NullEnd(Buf, TlLen);
X
X if(Buf[0] == '\0') /* prev was last song */
X return;
X
X /*
X * We have a title and maybe a counter
X * Fill these two in into a new SONG struct
X */
X New = NewSong();
X if(CountsWanted) {
X New->Count = NewString(CountBuf);
X } else {
X New->Count = NewString("");
X }
X New->Title = NewString(Buf);
X
X /*
X * Now add the song struct at the end of the song list
X */
X New->Next = (SONG *)0;
X
X if(*SongP == (SONG *)0) { /* deal separately with first */
X *SongP = New;
X } else {
X Curr = *SongP; /* find end of SONG list */
X while(Curr->Next != (SONG *)0)
X Curr = Curr->Next;
X
X Curr->Next = New;
X }
X TCount++;
X }
X}
@//E*O*F creat.c //
chars=`wc -c < creat.c | awk '{ print $1}'`
if test $chars != 5134
then
echo 'creat.c' is $chars characters,
echo should be 5134 characters\!
else
chmod u=rw-,g=r--,o=r-- $OUT
fi
echo x - data.c
if test -f data.c
then
echo data.c exists, putting output in $$data.c
OUT=$$data.c
else
OUT=data.c
fi
sed 's/^X//' > $OUT <<'@//E*O*F data.c //'
X#include "xdefs.h"
X
XCATITEM *FirstCatIt = (CATITEM *)0;
XCATITEM *LastCatIt = (CATITEM *)0;
X
XCASS CurCass[1];
XCATITEM *CurIt = (CATITEM *)0;
X
Xint NCatItems = 0;
Xchar LineBuf[100];
Xchar Buf[100];
@//E*O*F data.c //
chars=`wc -c < data.c | awk '{ print $1}'`
if test $chars != 210
then
echo 'data.c' is $chars characters,
echo should be 210 characters\!
else
chmod u=rw-,g=r--,o=r-- $OUT
fi
echo x - defines.h
if test -f defines.h
then
echo defines.h exists, putting output in $$defines.h
OUT=$$defines.h
else
OUT=defines.h
fi
sed 's/^X//' > $OUT <<'@//E*O*F defines.h //'
X#ifndef DEFINES_H
X#define DEFINES_H
X
X
X#define SCRLINES 24
X#define PARAMFILE1 "CASSETTE.DAT"
X#define PARAMFILE2 "/usr/local/lib/CASSETTE.DAT"
X
X
X/*
X * for select: WHAT do we want to select ?
X */
X#define SONGS1 1
X#define SONGS2 2
X#define CAT_ITEMS 3
X
X#define ENDMARKER 0
X#define QUIT 99
X
X/*
X * Main menu
X */
X#define LIST_COVERS 1
X#define DEL_COVERS 2
X#define RD_COVER 3
X#define CREAT_COVER 5
X#define EDIT_COVER 6
X#define SHO_COVER 7
X#define FILE_COVER 9
X
X/*
X * TapeType menu
X */
X#define NONE '0'
X#define FEO3 '1'
X#define CRO2 '2'
X#define FECR '3'
X#define METAL '4'
X
X/*
X * Noisereduction system menu
X */
X#define DOLBY_B '1'
X#define DOLBY_C '2'
X#define DBX '3'
X#define HXPRO '4'
X#define NO_NR '9'
X
X
X#define ALL 0x01
X#define TO_DELETE 0x02
X#define TO_PRINT 0x03
X#define TO_FILE 0x04
X
X
X
X#define SELECTED (flag)0x1
X
X
X
X#define CASSMAGIC "#XCASS-COVER-1"
X
X
X
X
X
X#endif DEFINES_H
@//E*O*F defines.h //
chars=`wc -c < defines.h | awk '{ print $1}'`
if test $chars != 884
then
echo 'defines.h' is $chars characters,
echo should be 884 characters\!
else
chmod u=rw-,g=r--,o=r-- $OUT
fi
echo x - del.c
if test -f del.c
then
echo del.c exists, putting output in $$del.c
OUT=$$del.c
else
OUT=del.c
fi
sed 's/^X//' > $OUT <<'@//E*O*F del.c //'
X#include <stdio.h>
X#include "defines.h"
X#include "xdefs.h"
X
X
Xextern void DelSelectedCovers();
Xextern void DelCatItem();
X
Xvoid
XDelCovers()
X{
X ListCovers(ALL);
X
X printf(" Enter the number(s) of the covers to be\n deleted: ");
X fflush(stdout);
X
X DoSelect(CAT_ITEMS, NCatItems); /* ask numbers of covers to delete */
X ListCovers(TO_DELETE);
X
X printf(" Do you really want to remove these covers ? (y/n) ...");
X fflush(stdout);
X
X if(!Confirm()) {
X UnSelect(CAT_ITEMS);
X return;
X }
X
X DelSelectedCovers();
X return;
X}
X
X
X
X
X/*----------------------------------------------*\
X | Delete all covers in the CATITEM list and |
X | also delete the files containing the cover |
X | information. |
X\*----------------------------------------------*/
Xstatic void
XDelSelectedCovers()
X{
X CATITEM *ItPt;
X CATITEM *Save;
X
X ItPt = FirstCatIt;
X while(ItPt != (CATITEM *)0) {
X Save = ItPt->Next;
X if(ItPt->Status & SELECTED) {
X unlink(ItPt->FileName);
X DelCatItem(ItPt);
X }
X ItPt = Save;
X }
X return;
X}
X
X
Xstatic void
XDelCatItem(It)
XCATITEM *It;
X{
X CATITEM *Prev;
X CATITEM *Curr;
X
X /*
X * If the current item is in the delete list, CurIt = 0
X */
X if(It == CurIt)
X ClearCurr();
X
X /*
X * First item requires special treatment.
X */
X if(It == FirstCatIt) {
X FirstCatIt = It->Next;
X free(It->FileName);
X free(It->Description);
X free(It);
X /*
X * When we delete last from list (in this case only one),
X * set LastCatIt as well
X */
X if(It == LastCatIt)
X LastCatIt = (CATITEM *)0;
X
X NCatItems--;
X return;
X }
X
X /*
X * Find 'It'
X */
X Curr = FirstCatIt;
X while(Curr != It) {
X Prev = Curr;
X Curr = Curr->Next;
X }
X
X /*
X * When this is the last item, make LastCatIt point to Prev
X * because Prev will be the last one in the list
X */
X if(LastCatIt == It)
X LastCatIt = Prev;
X
X /*
X * Curr points to It now.
X */
X free(It->FileName);
X free(It->Description);
X Prev->Next = Curr->Next; /* link previous to next item */
X free(It);
X NCatItems--;
X return;
X}
@//E*O*F del.c //
chars=`wc -c < del.c | awk '{ print $1}'`
if test $chars != 1946
then
echo 'del.c' is $chars characters,
echo should be 1946 characters\!
else
chmod u=rw-,g=r--,o=r-- $OUT
fi
echo x - edit.c
if test -f edit.c
then
echo edit.c exists, putting output in $$edit.c
OUT=$$edit.c
else
OUT=edit.c
fi
sed 's/^X//' > $OUT <<'@//E*O*F edit.c //'
X#include <stdio.h>
X#include "xdefs.h"
X#include "defines.h"
X
Xextern void DelSongs();
Xextern void EdSongs();
Xextern void RmSong();
X
X
Xvoid
XEditCover()
X{
X int Choice;
X int Done = 0;
X
X
X /*
X * when no cover is read in, return
X */
X if(CurIt == (CATITEM *)0) {
X Attention("First read in the cover you wich to edit");
X return;
X }
X
X while(Done == 0) {
X NLines(SCRLINES - 6 - 13); /* 6 is for ShowGlobal() */
X ShowGlobal(CurIt, CurCass);
X
X printf(" CHOOSE ONE OF THE FOLLOWING OPTIONS:\n");
X NLines(1);
X printf(" 1) Change description\n");
X printf(" 2) Change tape type\n");
X printf(" 3) Change noise reduction system\n");
X printf(" 4) Change back code\n");
X printf(" 5) Change back title 1\n");
X printf(" 6) Change back title 2\n");
X printf(" 7) Edit titles of side 1 and 2\n");
X printf(" 8) UNDO all changes\n");
X printf(" 9) Return to main menu\n");
X NLines(1);
X
X printf(" Enter your choice ..."); fflush(stdout);
X gets(Buf);
X Choice = atoi(Buf);
X
X switch(Choice) {
X case 1:
X InDescription(CurIt);
X break;
X case 2:
X InTapeType();
X break;
X case 3:
X InNoiseRed();
X break;
X case 4:
X InBackCode();
X break;
X case 5:
X InBackTitle(1, &(CurCass->BackTl1));
X break;
X case 6:
X InBackTitle(2, &(CurCass->BackTl2));
X break;
X case 7:
X Done = 1;
X break;
X case 8:
X ClearCass(CurCass);
X ReadCover(CurIt, CurCass);
X break;
X case 9:
X return;
X }
X }
X
X EdSongs(CurCass, 1);
X EdSongs(CurCass, 2);
X return;
X}
X
X
Xstatic void
XEdSongs(Cas, Side)
XCASS *Cas;
Xint Side;
X{
X SONG *SongP;
X SONG *Save;
X SONG **List;
X int Choice;
X int NSongs;
X int Num;
X
X if(Side == 1)
X List = &(Cas->Side1);
X else
X List = &(Cas->Side2);
X
X while(1) {
X NSongs = CountSongs(*List);
X
X NLines(SCRLINES - NSongs-1 - 8);
X ShowSongs(*List, Side);
X NLines(1);
X
X printf(" CHOOSE ONE OF THE FOLLOWING OPTIONS:\n");
X printf(" 1) Add a title\n");
X printf(" 2) Delete one or more titles\n");
X printf(" 3) Change a title\n");
X printf(" 4) UNDO changes\n");
X printf(" 5) Ready\n");
X printf(" Enter your choice ..."); fflush(stdout);
X gets(Buf);
X Choice = atoi(Buf);
X
X switch(Choice) {
X case 1: /* ADD TITLE */
X printf(" After which title (0 for begin) do you want to add\n");
X printf(" the new title ? ... ");
X fflush(stdout);
X gets(Buf);
X Num = atoi(Buf);
X
X switch(Num) {
X case 0:
X /*
X * Put new song at beginning of the list
X */
X Save = *List;
X *List = NewSong();
X (*List)->Next = Save;
X SongP = *List;
X break;
X case 1:
X Save = (*List)->Next;
X SongP = NewSong();
X SongP->Next = Save;
X Save->Next = SongP;
X break;
X default:
X SongP = FindSong(*List, Num); /* returns pt to prev it */
X if(SongP == (SONG *)0 || SongP->Next == (SONG *)0) {
X Attention("Title %d does not exist!", Num);
X break;
X }
X SongP = SongP->Next;
X /*
X * get new SONG struct and insert into the list
X */
X Save = SongP;
X SongP = NewSong();
X SongP->Next = Save->Next;
X Save->Next = SongP;
X }
X
X NLines(SCRLINES-1);
X
X /*
X * Get new counter
X */
X printf("What is the tape counter reading (max %d character) ? .. ",
X CtLen);
X fflush(stdout);
X
X gets(Buf);
X NullEnd(Buf, CtLen);
X SongP->Count = NewString(Buf);
X
X /*
X * Get new title
X */
X printf("What is the title (max %d characters) ? .. ", TlLen);
X fflush(stdout);
X
X gets(Buf);
X NullEnd(Buf, TlLen);
X SongP->Title = NewString(Buf);
X break;
X
X case 2: /* DEL TITLE */
X DelSongs(Side);
X break;
X
X case 3: /* CHANGE TITLE */
X printf("Which title do you want to change ? ..."); fflush(stdout);
X gets(Buf);
X Num = atoi(Buf);
X
X if(Num == 0) {
X Attention("Title %d does not exist", Num);
X break;
X }
X
X if(Num == 1) {
X SongP = *List;
X } else {
X SongP = FindSong(*List, Num);
X if(SongP == (SONG *)0 || SongP->Next == (SONG *)0) {
X Attention("Title %d does not exist", Num);
X break;
X }
X SongP = SongP->Next;
X }
X
X NLines(SCRLINES-2);
X printf("Old title: %s: %s\n", SongP->Count, SongP->Title);
X
X free(SongP->Count);
X SongP->Count = (char *)0;
X free(SongP->Title);
X SongP->Title = (char *)0;
X
X /*
X * Get new counter
X */
X printf("What is the new tape counter reading (max %d characters) ? ",
X CtLen);
X fflush(stdout);
X
X gets(Buf);
X NullEnd(Buf, CtLen);
X SongP->Count = NewString(Buf);
X
X /*
X * Get new title
X */
X printf("What is the new title (max %d characters) ? .. ", TlLen);
X fflush(stdout);
X
X gets(Buf);
X NullEnd(Buf, TlLen);
X SongP->Title = NewString(Buf);
X break;
X
X case 4:
X ClearCass(CurCass);
X ReadCover(CurIt, CurCass);
X break;
X
X case 5:
X return;
X }
X }
X}
X
X
X
Xstatic void
XDelSongs(Side)
Xint Side;
X{
X int NSongs;
X SONG *SongP;
X SONG *Following;
X SONG **List;
X
X printf(" Specify the titles to be deleted: ");
X fflush(stdout);
X
X if(Side == 1) {
X List = &(CurCass->Side1);
X NSongs = CountSongs(*List);
X DoSelect(SONGS1, NSongs);
X } else {
X List = &(CurCass->Side2);
X NSongs = CountSongs(*List);
X DoSelect(SONGS2, NSongs);
X }
X
X SongP = *List;
X while(SongP != (SONG *)0) {
X if(SongP->Status & SELECTED) {
X Following = SongP->Next;
X RmSong(SongP, List);
X SongP = Following;
X } else {
X SongP = SongP->Next;
X }
X }
X return;
X}
X
X
Xstatic void
XRmSong(SongP, List)
XSONG *SongP;
XSONG **List;
X{
X SONG *Prev;
X SONG *Curr;
X
X
X /*
X * Now delete these songs
X */
X /*
X * First item requires special treatment.
X */
X if(SongP == *List) {
X *List = (*List)->Next;
X
X free(SongP->Count);
X SongP->Count = (char *)0;
X free(SongP->Title);
X SongP->Title = (char *)0;
X free(SongP);
X
X SongP = (SONG *)0;
X return;
X }
X
X /*
X * Find 'SongP'
X */
X Curr = *List;
X while(Curr != SongP) {
X Prev = Curr;
X Curr = Curr->Next;
X }
X
X /*
X * Curr points to SongP now.
X */
X free(Curr->Count);
X Curr->Count = (char *)0;
X free(Curr->Title);
X Curr->Title = (char *)0;
X
X Prev->Next = Curr->Next; /* link previous to next item */
X free(Curr);
X Curr = (SONG *)0;
X return;
X}
@//E*O*F edit.c //
chars=`wc -c < edit.c | awk '{ print $1}'`
if test $chars != 6036
then
echo 'edit.c' is $chars characters,
echo should be 6036 characters\!
else
chmod u=rw-,g=r--,o=r-- $OUT
fi
echo x - list.c
if test -f list.c
then
echo list.c exists, putting output in $$list.c
OUT=$$list.c
else
OUT=list.c
fi
sed 's/^X//' > $OUT <<'@//E*O*F list.c //'
X#include <stdio.h>
X#include "defines.h"
X#include "xdefs.h"
X
X
X
X/*----------------------------------*\
X | Show a list of available covers |
X\*----------------------------------*/
Xvoid
XListCovers(Func)
Xint Func;
X{
X CATITEM *It;
X int NIts;
X int NLinesThisPage;
X int NItsThisPage;
X int NGroupsPerPage;
X int Rest;
X
X
X NGroupsPerPage = (SCRLINES-5) / 6; /* including separation line */
X Rest = SCRLINES-5 - NGroupsPerPage*6;
X
X NLines(3);
X switch(Func) {
X case ALL:
X printf(" LIST OF AVAILABLE COVERS :\n");
X printf("---------------------------\n");
X break;
X case TO_DELETE:
X printf(" LIST OF COVERS TO BE DELETED :\n");
X printf("-------------------------------\n");
X break;
X case TO_PRINT:
X printf(" LIST OF COVERS TO BE PRINTED :\n");
X printf("-------------------------------\n");
X /*
X * This won't happen, but you may of course add your own code
X * to support this one.
X * Then, add an entry in main menu, a case in cas.c
X * and change output.c to fit your needs.
X */
X break;
X case TO_FILE:
X printf(" LIST OF COVERS TO BE PRINTED TO DISK :\n");
X printf("---------------------------------------\n");
X break;
X }
X
X NIts = 0;
X NLinesThisPage = 0;
X NItsThisPage = 0;
X
X for(It = FirstCatIt; It != (CATITEM *)0; It = It->Next) {
X if(Func != ALL && !(It->Status & SELECTED))
X continue;
X
X printf(" %3d) %s\n", NIts+1, It->Description);
X NIts++;
X NLinesThisPage++;
X NItsThisPage++;
X
X if((NIts % 5) == 0) {
X NLines(1);
X NLinesThisPage++;
X }
X
X if(NItsThisPage >= NGroupsPerPage*5) {
X /*
X * new page
X */
X NLines(Rest+1);
X RetCont();
X NLines(4);
X NLinesThisPage = 0;
X NItsThisPage = 0;
X }
X }
X
X NLines(SCRLINES-5 - NLinesThisPage-1);
X return;
X}
@//E*O*F list.c //
chars=`wc -c < list.c | awk '{ print $1}'`
if test $chars != 1709
then
echo 'list.c' is $chars characters,
echo should be 1709 characters\!
else
chmod u=rw-,g=r--,o=r-- $OUT
fi
echo x - menu.c
if test -f menu.c
then
echo menu.c exists, putting output in $$menu.c
OUT=$$menu.c
else
OUT=menu.c
fi
sed 's/^X//' > $OUT <<'@//E*O*F menu.c //'
X#include <stdio.h>
X#include "defines.h"
X#include "xdefs.h"
X
X
Xextern void PrintMenu();
X
X
X
X/*---------------------------------------------------------------------------*/
X
XMLINE MainItems[] = {
X "Show a list of cassettecovers", LIST_COVERS,
X "Delete cover(s)", DEL_COVERS,
X "Create a new cover", CREAT_COVER,
X "Read in an existing cover", RD_COVER,
X "Edit a read-in cover", EDIT_COVER,
X "Show read-in cover on the screen", SHO_COVER,
X "Print cover(s) to Postscript-file", FILE_COVER,
X "Quit", QUIT,
X "", ENDMARKER
X};
X
XMENUITEM MainMenu = {
X " MAIN MENU - CHOOSE ONE OF THE FOLLOWING OPTIONS:", 0,
X MainItems
X};
X
X
X/*---------------------------------------------------------------------------*/
X
XMLINE TapeItems[] = {
X "I Ferro (Normal)", FEO3,
X "II Chromedioxide (Chromium)", CRO2,
X "III Ferrochrome", FECR,
X "IV Metal", METAL,
X "", ENDMARKER
X};
X
XMENUITEM TapeMenu = {
X " TAPE TYPE - CHOOSE A TAPE TYPE", 0,
X TapeItems
X};
X
X
X/*---------------------------------------------------------------------------*/
X
XMLINE NoiseItems[] = {
X "Dolby B", DOLBY_B,
X "Dolby C", DOLBY_C,
X "DBX", DBX,
X "HX-PRO", HXPRO,
X "No noise reduction", NO_NR,
X "", ENDMARKER
X};
X
XMENUITEM NoiseMenu = {
X " NOISE SUPPRESSION - WHICH SYSTEM ?", 0,
X NoiseItems
X};
X
X/*---------------------------------------------------------------------------*/
X
X
X
X
X/*--------------*\
X | Print a menu |
X\*--------------*/
Xstatic void
XPrintMenu(Menu)
XMENUITEM *Menu;
X{
X MLINE *EntryP;
X int MCount;
X
X NLines(SCRLINES - Menu->NEntries*2 - 2);
X printf("%s\n\n", Menu->MenuTitle);
X
X /*
X * Print the items of the menu
X */
X MCount = 1;
X EntryP = Menu->Entry;
X while(EntryP->Func != ENDMARKER) {
X printf("\t%2d) %s\n\n", MCount, EntryP->Text);
X EntryP++;
X MCount++;
X }
X printf(" Enter your choice: "); fflush(stdout);
X return;
X}
X
X
X
X
Xvoid
XInitMenu(Menu)
XMENUITEM *Menu;
X{
X MLINE *EntryP;
X int MCount;
X
X /*
X * Count the number of menu items.
X */
X MCount = 0;
X EntryP = Menu->Entry;
X while(EntryP++->Func != ENDMARKER)
X MCount++;
X
X Menu->NEntries = MCount;
X return;
X}
X
X
XChooseMenu(Menu)
XMENUITEM *Menu;
X{
X int Choice;
X char Buf[100];
X
X do {
X PrintMenu(Menu);
X gets(Buf);
X Choice = atoi(Buf);
X } while(Choice < 1 || Choice > Menu->NEntries);
X return(Menu->Entry[Choice-1].Func);
X}
@//E*O*F menu.c //
chars=`wc -c < menu.c | awk '{ print $1}'`
if test $chars != 2323
then
echo 'menu.c' is $chars characters,
echo should be 2323 characters\!
else
chmod u=rw-,g=r--,o=r-- $OUT
fi
echo x - mktmp.c
if test -f mktmp.c
then
echo mktmp.c exists, putting output in $$mktmp.c
OUT=$$mktmp.c
else
OUT=mktmp.c
fi
sed 's/^X//' > $OUT <<'@//E*O*F mktmp.c //'
X#include <stdio.h>
X#include "xdefs.h"
X
X/*----------------------------------------------*\
X | Write a filename into buffer FName. A file- |
X | name is created from a template by incremen- |
X | ting the last characters of the filename |
X | until an unused name is obtained. |
X\*----------------------------------------------*/
X
Xstatic char *Template = "COVERAAA.COV";
X/*
X * FIXED denotes the number of chars that do not change
X * NVARS is number of characters that vary.
X */
X#define FIXED 5
X#define NVARS 3
X
X
Xextern int FNUsed();
Xextern int FNPresent();
Xextern void FNIncr();
X
Xvoid
XMkTmp(FName)
Xchar *FName;
X{
X StringCopy(Template, FName);
X while(FNUsed(FName)) {
X FNIncr(FName);
X }
X return;
X}
X
X/***************************************************************************/
X/* ONLY STATIC FUNCTIONS UNDER THIS LINE */
X/***************************************************************************/
X
X
X
X/*
X * Check if an item with filename Name is present.
X * Do this by comparing with all Itemfilenames.
X */
Xstatic
XFNUsed(Name)
Xchar *Name;
X{
X CATITEM *ItPt;
X FILE *Fp;
X int Found;
X
X ItPt = FirstCatIt;
X Found = 0;
X while(ItPt != (CATITEM *)0 && Found == 0) {
X if(!StringDiff(Name, ItPt->FileName)) {
X Found = 1;
X break;
X }
X ItPt = ItPt->Next;
X }
X if(Found == 0) {
X /*
X * Filename is not present in the list, but
X * although the chance is very small there may be
X * a file with this name by coincidence.
X * So .. check if it can be opened.
X */
X if((Fp = fopen(Name, "r")) != NULL) {
X fclose(Fp);
X Found = 1;
X }
X }
X return(Found);
X}
X
X
Xvoid
XFNIncr(Name)
Xchar *Name;
X{
X char *Cp;
X int NChars;
X
X Cp = Name + FIXED;
X
X for(NChars = 0; NChars < NVARS; NChars++) {
X if(*Cp == 'Z') {
X *Cp = 'A';
X Cp++;
X continue;
X } else {
X ++*Cp;
X return;
X }
X }
X Panic("Too many cassettecovers !!! Delete some!");
X return;
X}
@//E*O*F mktmp.c //
chars=`wc -c < mktmp.c | awk '{ print $1}'`
if test $chars != 1858
then
echo 'mktmp.c' is $chars characters,
echo should be 1858 characters\!
else
chmod u=rw-,g=r--,o=r-- $OUT
fi
echo x - new_it.c
if test -f new_it.c
then
echo new_it.c exists, putting output in $$new_it.c
OUT=$$new_it.c
else
OUT=new_it.c
fi
sed 's/^X//' > $OUT <<'@//E*O*F new_it.c //'
X#include <stdio.h>
X#include "xdefs.h"
X
Xextern void NoMem();
X
X/*----------------------------------------------*\
X | Allocate space for string s and copy s to |
X | this space. Return pointer to new space. |
X\*----------------------------------------------*/
Xchar *
XNewString(s)
Xchar *s;
X{
X char *NewP;
X char *calloc();
X
X if((NewP = (char *)calloc(sizeof(char), StringLen(s)+1)) == (char *)0)
X NoMem("NewString");
X
X StringCopy(s, NewP);
X return(NewP);
X}
X
X
X/*--------------------------------------*\
X | Allocate space for CATITEM struct |
X\*--------------------------------------*/
XCATITEM *
XNewCatItem()
X{
X CATITEM *NewP;
X char *malloc();
X
X if((NewP = (CATITEM *)(malloc(sizeof(CATITEM)))) == (CATITEM *)0)
X NoMem("NewCatItem");
X
X return(NewP);
X}
X
X
X
X/*------------------------------*\
X | Allocate for new SONG struct |
X\*------------------------------*/
XSONG *
XNewSong()
X{
X SONG *NewP;
X char *malloc();
X
X if((NewP = (SONG *)malloc(sizeof(SONG))) == (SONG *)0)
X NoMem("NewSong");
X
X NewP->Status = 0;
X return(NewP);
X}
X
X
X
X
X
Xstatic void
XNoMem(Func)
Xchar *Func;
X{
X Panic("Out of memory in funtion %s", Func);
X}
@//E*O*F new_it.c //
chars=`wc -c < new_it.c | awk '{ print $1}'`
if test $chars != 1110
then
echo 'new_it.c' is $chars characters,
echo should be 1110 characters\!
else
chmod u=rw-,g=r--,o=r-- $OUT
fi
echo x - output.c
if test -f output.c
then
echo output.c exists, putting output in $$output.c
OUT=$$output.c
else
OUT=output.c
fi
sed 's/^X//' > $OUT <<'@//E*O*F output.c //'
X#include <stdio.h>
X#include "xdefs.h"
X#include "defines.h"
X
Xstatic CASS OutCass[4];
Xstatic FILE *CovFp;
X
X
Xextern void CovOutput();
X
X
X
Xvoid
XOutCovers(Func)
Xint Func;
X{
X int CovCount;
X CATITEM *It;
X
X
X ListCovers(ALL);
X
X printf(" Enter the numbers of the cover to be\n printed (to disk): ");
X fflush(stdout);
X
X DoSelect(CAT_ITEMS, NCatItems); /* ask numbers of covers to delete */
X ListCovers(Func);
X
X printf("\n Do you want to print these covers to postscript file ? (y/n) ");
X fflush(stdout);
X
X if(!Confirm()) {
X UnSelect(CAT_ITEMS);
X return;
X }
X
X CovCount = 0;
X It = FirstCatIt;
X /*
X * read in the covers in groups of four and output them.
X */
X if((CovFp = fopen("COVERS.PS", "w")) == NULL)
X Panic("Can't create output file");
X
X while(It != (CATITEM *)0) {
X if((It->Status & SELECTED) == 0) {
X It = It->Next;
X continue;
X }
X ReadCover(It, &(OutCass[CovCount]));
X CovCount++;
X if((CovCount % 4) == 0) {
X CovOutput(CovCount);
X CovCount = 0;
X }
X It = It->Next;
X }
X CovOutput(CovCount);
X fclose(CovFp);
X}
X
X
Xstatic void
XCovOutput(NCovs)
Xint NCovs;
X{
X int CovCount;
X CASS *OutC;
X SONG *SongP;
X int SongY;
X
X if(NCovs == 0) return;
X
X fprintf(CovFp, "%%!\n");
X
X /*
X * tenths of millimeters:
X */
X fprintf(CovFp, "/tmm { 0.283464 mul } def\n");
X fprintf(CovFp, "90 rotate\n");
X fprintf(CovFp, "150 tmm -2100 tmm translate\n");
X
X
X
X
X for(CovCount = 0; CovCount < NCovs; CovCount++) {
X switch(CovCount) {
X case 0:
X OutC = OutCass;
X fprintf(CovFp, "80 tmm 70 tmm translate\n");
X break;
X case 1:
X OutC = &(OutCass[1]);
X fprintf(CovFp, "1070 tmm 0 tmm translate\n");
X break;
X case 2:
X OutC = &(OutCass[2]);
X fprintf(CovFp, "0 tmm 970 tmm translate\n");
X break;
X case 3:
X OutC = &(OutCass[3]);
X fprintf(CovFp, "-1070 tmm 0 tmm translate\n");
X break;
X default:
X Panic("Error in output routine; CovCount = %d!\n", CovCount);
X }
X /*
X * Draw lines first
X */
X fprintf(CovFp, "newpath\n");
X
X fprintf(CovFp, "0.1 setlinewidth\n");
X
X /*
X * upper two folding lines
X */
X fprintf(CovFp, "1 tmm 295 tmm moveto\n");
X fprintf(CovFp, "3 tmm 295 tmm lineto\n");
X fprintf(CovFp, "1011 tmm 295 tmm moveto\n");
X fprintf(CovFp, "1013 tmm 295 tmm lineto\n");
X
X /*
X * lower two folding lines
X */
X fprintf(CovFp, "1 tmm 160 tmm moveto\n");
X fprintf(CovFp, "3 tmm 160 tmm lineto\n");
X fprintf(CovFp, "1011 tmm 160 tmm moveto\n");
X fprintf(CovFp, "1013 tmm 160 tmm lineto\n");
X
X /*
X * Top cutting line
X */
X fprintf(CovFp, "1 tmm 960 tmm moveto\n");
X fprintf(CovFp, "1015 tmm 960 tmm lineto\n");
X
X /*
X * Bottom cutting line
X */
X fprintf(CovFp, "1 tmm 1 tmm moveto\n");
X fprintf(CovFp, "1015 tmm 1 tmm lineto\n");
X
X /*
X * Left cutting line
X */
X fprintf(CovFp, "1 tmm 1 tmm moveto\n");
X fprintf(CovFp, "1 tmm 960 tmm lineto\n");
X
X /*
X * Right cutting line
X */
X fprintf(CovFp, "1015 tmm 1 tmm moveto\n");
X fprintf(CovFp, "1015 tmm 960 tmm lineto\n");
X
X
X
X /*
X * Horizontal line on the front
X * Vertical line in the middle
X */
X fprintf(CovFp, "0.5 setlinewidth\n");
X fprintf(CovFp, "%d tmm %d tmm moveto\n", FTlSepX1, FTlSepY);
X fprintf(CovFp, "%d tmm %d tmm lineto\n", FTlSepX2, FTlSepY);
X
X fprintf(CovFp, "%d tmm %d tmm moveto\n", FVSepX, FVSepY1);
X fprintf(CovFp, "%d tmm %d tmm lineto\n", FVSepX, FVSepY2);
X
X fprintf(CovFp, "stroke\n");
X
X
X
X /*
X * 'Designed by' ... message......
X */
X fprintf(CovFp, "/%s findfont\n", BTFont); /* set font */
X fprintf(CovFp, "3 scalefont setfont\n"); /* and size */
X fprintf(CovFp, "880 tmm 20 tmm moveto\n");
X fprintf(CovFp, "(Design: R.M. Bruijne) show\n");
X
X /*
X * Do Backcode
X */
X fprintf(CovFp, "/%s findfont\n", CodeFont); /* set font */
X fprintf(CovFp, "%d scalefont setfont\n", CodeFSize); /* and size */
X
X if(*(OutC->BackCode) != '\0') {
X fprintf(CovFp, "%d tmm %d tmm moveto\n", CodeXPos, CodeYPos);
X fprintf(CovFp, "(%s) show\n", OutC->BackCode);
X }
X
X /*
X * Do Tapetype
X */
X fprintf(CovFp, "/%s findfont\n", TsNrFont); /* set font */
X fprintf(CovFp, "%d scalefont setfont\n", TsNrFSize); /* and size */
X fprintf(CovFp, "%d tmm %d tmm moveto\n", TsXPos, TsYPos);
X
X switch(OutC->TapeType) {
X case FEO3:
X fprintf(CovFp, "(I, FERRO) show\n"); /* tapetype */
X break;
X case CRO2:
X fprintf(CovFp, "(II, CHROME) show\n"); /* tapetype */
X break;
X case FECR:
X fprintf(CovFp, "(III, FERROCHROME) show\n"); /* tapetype */
X break;
X case METAL:
X fprintf(CovFp, "(IV, METAL) show\n"); /* tapetype */
X break;
X }
X
X /*
X * Do Noisereduction
X */
X fprintf(CovFp, "%d tmm %d tmm moveto\n", NrXPos, NrYPos);
X switch(OutC->NoiseReduction) {
X case DOLBY_B:
X fprintf(CovFp, "(DOLBY B) show\n"); /* noisesys */
X break;
X case DOLBY_C:
X fprintf(CovFp, "(DOLBY C) show\n"); /* noisesys */
X break;
X case DBX:
X fprintf(CovFp, "(DBX) show\n"); /* noisesys */
X break;
X case HXPRO:
X fprintf(CovFp, "(HX-PRO) show\n"); /* noisesys */
X break;
X case NO_NR:
X fprintf(CovFp, "(NO NR.) show\n"); /* noisesys */
X break;
X }
X
X
X /*
X * Do Backtitles
X */
X fprintf(CovFp, "/%s findfont\n", BTFont); /* set font */
X fprintf(CovFp, "%d scalefont setfont\n", BTFSize); /* and size */
X
X if(*(OutC->BackTl1) != '\0') {
X fprintf(CovFp, "%d tmm %d tmm moveto\n", BT1XPos, BT1YPos);
X fprintf(CovFp, "(%s) show\n", OutC->BackTl1);
X }
X
X if(*(OutC->BackTl2) != '\0') {
X fprintf(CovFp, "%d tmm %d tmm moveto\n", BT2XPos, BT2YPos);
X fprintf(CovFp, "(%s) show\n", OutC->BackTl2);
X }
X
X
X /*
X * Do Side A and side B markers on front of cover
X */
X fprintf(CovFp, "/%s findfont\n", FrABFont); /* set font */
X fprintf(CovFp, "%d scalefont setfont\n", FrABFSize); /* and size */
X
X fprintf(CovFp, "%d tmm %d tmm moveto\n", FrAXPos, FrAYPos);
X fprintf(CovFp, "(A) show\n");
X
X fprintf(CovFp, "%d tmm %d tmm moveto\n", FrBXPos, FrBYPos);
X fprintf(CovFp, "(B) show\n");
X
X /*
X * Do backtitles on front of cover
X */
X fprintf(CovFp, "/%s findfont\n", FrTlFont); /* set font */
X fprintf(CovFp, "%d scalefont setfont\n", FrTlFSize); /* and size */
X
X if(*(OutC->BackTl1) != '\0') {
X fprintf(CovFp, "%d tmm %d tmm moveto\n", FrTl1XPos, FrTl1YPos);
X fprintf(CovFp, "(%s) show\n", OutC->BackTl1);
X }
X
X if(*(OutC->BackTl2) != '\0') {
X fprintf(CovFp, "%d tmm %d tmm moveto\n", FrTl2XPos, FrTl2YPos);
X fprintf(CovFp, "(%s) show\n", OutC->BackTl2);
X }
X
X /*
X * Now titles of songs
X */
X fprintf(CovFp, "/%s findfont\n", TlFont); /* set font */
X fprintf(CovFp, "%d scalefont setfont\n", TlFSize); /* and size */
X
X /*
X * SIDE 1
X */
X SongP = OutC->Side1;
X SongY = Tl1YPos;
X while(SongP != (SONG *)0) {
X if(*(SongP->Count) != '\0') {
X fprintf(CovFp, "%d tmm %d tmm moveto\n", Tl1XPos, SongY);
X fprintf(CovFp, "(%s) show\n", SongP->Count);
X }
X if(*(SongP->Title) != '\0') {
X fprintf(CovFp, "%d tmm %d tmm moveto\n",
X Tl1XPos+CtTlXDist, SongY);
X fprintf(CovFp, "(%s) show\n", SongP->Title);
X }
X SongY -= TlLDist;
X SongP = SongP->Next;
X }
X
X /*
X * SIDE 2
X */
X SongP = OutC->Side2;
X SongY = Tl2YPos;
X while(SongP != (SONG *)0) {
X if(*(SongP->Count) != '\0') {
X fprintf(CovFp, "%d tmm %d tmm moveto\n", Tl2XPos, SongY);
X fprintf(CovFp, "(%s) show\n", SongP->Count);
X }
X if(*(SongP->Title) != '\0') {
X fprintf(CovFp, "%d tmm %d tmm moveto\n",
X Tl2XPos+CtTlXDist, SongY);
X fprintf(CovFp, "(%s) show\n", SongP->Title);
X }
X SongY -= TlLDist;
X SongP = SongP->Next;
X }
X ClearCass(OutC);
X
X }
X fprintf(CovFp, "showpage\n");
X return;
X}
@//E*O*F output.c //
chars=`wc -c < output.c | awk '{ print $1}'`
if test $chars != 7508
then
echo 'output.c' is $chars characters,
echo should be 7508 characters\!
else
chmod u=rw-,g=r--,o=r-- $OUT
fi
echo x - params.c
if test -f params.c
then
echo params.c exists, putting output in $$params.c
OUT=$$params.c
else
OUT=params.c
fi
sed 's/^X//' > $OUT <<'@//E*O*F params.c //'
X/*--------------------------------------*\
X | file containing the definitions of |
X | all parameters present in the data- |
X | file. These parameters define the |
X | format of the cover. |
X\*--------------------------------------*/
X
Xint CodeXPos; /* Backcode parameter 1 */
Xint CodeYPos; /* Backcode parameter 1 */
Xint CodeLen; /* Backcode parameter 2 */
Xchar *CodeFont; /* Backcode parameter 3 */
Xint CodeFSize; /* Backcode parameter 4 */
X
Xint TsXPos; /* Tapetype xpos, parameter 5 */
Xint TsYPos; /* Tapetype ypos, parameter 5 */
Xint NrXPos; /* NoiseRed xpos, parameter 6 */
Xint NrYPos; /* NoiseRed ypos, parameter 6 */
Xchar *TsNrFont; /* tapetype&NoiseRed font, p 7 */
Xint TsNrFSize; /* ts & NoiseRed fontsize, p 8 */
X
Xint BT1XPos; /* Backtitle 1 xpos, param 9 */
Xint BT1YPos; /* Backtitle 1 ypos, param 9 */
Xint BT2XPos; /* Backtitle 2 xpos, param 10 */
Xint BT2YPos; /* Backtitle 2 ypos, param 10 */
Xint BTLen; /* Backtitle Length, param 11 */
Xchar *BTFont; /* Backtitle font, param 12 */
Xint BTFSize; /* Backtitel fontsize, param 13 */
X
Xint FrAXPos; /* Front A, xpos, param 14 */
Xint FrAYPos; /* Front A, ypos, param 14 */
Xint FrBXPos; /* Front B, xpos, param 15 */
Xint FrBYPos; /* Front B, ypos, param 15 */
Xchar *FrABFont; /* Front A&B, font, param 16 */
Xint FrABFSize; /* Front A&B, fontsize, par 17 */
X
Xint FrTl1XPos; /* Front title 1 xpos, par 18 */
Xint FrTl1YPos; /* Front title 1 ypos, par 18 */
Xint FrTl2XPos; /* Front title 2 xpos, par 19 */
Xint FrTl2YPos; /* Front title 2 ypos, par 19 */
Xchar *FrTlFont; /* Fronttitle font, param 20 */
Xint FrTlFSize; /* Fronttitle fontsiz, param 21 */
X
Xint Tl1XPos; /* Title 1 xpos, param 22 */
Xint Tl1YPos; /* Title 1 ypos, param 22 */
Xint Tl2XPos; /* Title 2 xpos, param 23 */
Xint Tl2YPos; /* Title 2 ypos, param 23 */
Xint TlLen; /* length of title, par 24 */
Xint TlLDist; /* line spacing titles, par 25 */
Xchar *TlFont; /* Title font, parameter 26 */
Xint TlFSize; /* and fontsize, parameter 27 */
X
Xint CtTlXDist; /* Dist between tl and ct,par28 */
Xint CtLen; /* countlength, parameter 29 */
X
Xint FTlSepX1; /* horizontal line front xfrom */
Xint FTlSepX2; /* horizontal line front xto */
Xint FTlSepY; /* horizontal line front y */
X
Xint FVSepX; /* front separation line x */
Xint FVSepY1; /* front separation line yfrom */
Xint FVSepY2; /* front separation line yto */
X
X
X
X/*
X * That's it!
X */
@//E*O*F params.c //
chars=`wc -c < params.c | awk '{ print $1}'`
if test $chars != 2465
then
echo 'params.c' is $chars characters,
echo should be 2465 characters\!
else
chmod u=rw-,g=r--,o=r-- $OUT
fi
# End of shell archive
exit 0
--------------cut here------------
--
---------------------------------------------------------------------------
Remco Bruijne USENET: remco at tnoibbc.ibbc.tno.nl PHONE: +31 15 606437
---------------------------------------------------------------------------
More information about the Comp.sources.misc
mailing list