Search:

Return to previous page

Contents of file 'dvlabel.c':



/*5:*/
#line 410 "./dvlabel.w"

#include <time.h> 
#include <stdio.h> 
#include <stddef.h> 
#include <stdlib.h> 
#include <string.h> 

#define VERSION "1.5" 
#define DEFAULT_DVIPSOPTS "-ta4 -D1200" 
#define DEFAULT_LINETHICKNESS (0.5) 
#define DEFAULT_CROPLINETHICKNESS (0.15) 
#define DEFAULT_EDGESEPARATION (1.0)
#define MAXCHAR (128) 

#define SUCCESS (0) 
#define FAILURE (1) 

#define INSTREAM (infile_specified?infile:stdin)
#define OUTSTREAM (outfile_specified?outfile:stdout)

/*6:*/
#line 477 "./dvlabel.w"

extern char*optarg;
char*progname;

/*:6*/
#line 430 "./dvlabel.w"

/*7:*/
#line 483 "./dvlabel.w"

/*8:*/
#line 490 "./dvlabel.w"

/*9:*/
#line 499 "./dvlabel.w"

void hl(char firststring[],char secondstring[]){
fprintf(stderr,"%-25.25s%1.65s\n",firststring,secondstring);
}

/*:9*/
#line 491 "./dvlabel.w"

/*10:*/
#line 508 "./dvlabel.w"

void fhl(char linestring[]){
fprintf(stderr,"%s\n",linestring);
}

/*:10*/
#line 492 "./dvlabel.w"

/*11:*/
#line 515 "./dvlabel.w"

void showsomehelp(void){
char tmpstr[80];
sprintf(tmpstr,"Usage: %s [options]",progname);
fhl(tmpstr);
fhl("When invoked without any command line options, this program enters");
fhl("interactive mode.");
fhl("Options:");
hl("  -i, --inputfile <str>",
"Specifies the file where to read the label text");
hl("","strings, entered in a format corresponding to the");
hl("","input order as would have been entered in inter-");
hl("","active mode.");
hl("  -o, --outputfile <str>",
"Specifies the file where to save the generated");
hl("","TeX source code for the label. whenever this");
hl("","option is omitted, the generated source code");
hl("","will be written to standard terminal output");
hl("","instead.");
hl("","   Notice that the name specified using this");
hl("","option is used as the *base name* for the");
hl("","generated output; this means that the TeX file");
hl("","automatically will get .tex as suffix, the DVI");
hl("","file .dvi, etc. For example, if you want to");
hl("","have the TeX output stored into a file named,");
hl("","say, 'foo.tex', just specify '-o foo'.");
hl("","Toggle display of generation time and input");
hl("","source in page header of the generated TeX");
hl("","code. Default: off");
hl("","Toggle display of crop marks (alignment marks)");
hl("","in the generated TeX code. Default: off");
hl("  -t, --linethick <f>","Use linethickness of <f> typographic points in");
hl("","generating the boxes of the label. (One point,");
hl("","or pt, equals to 1/72.27 inch, or 0.351 mm.)");
hl("  -s, --edgeseparation <f>",
"Insert extra space of <f> typographic points");
hl("","between the text boxes at the folded edges of");
hl("","the label. This is useful when, for example,");
hl("","thick paper is used.");
hl("","By changing the line thickness, the internal");
hl("","margins of the label are also changed, since");
hl("","the inner edge-to-edge distance between the");
hl("","lines of the inner and outer boxes are linked");
hl("","to be twice the value of the line thickness.");
hl("","The correction of inner bounding boxes of the");
hl("","label text is automatically adjusted so as to");
hl("","ensure that the overall outer dimensions of the");
hl("","label are unchanged.");
hl("  -c, --compile","Try to compile the generated TeX code. This");
hl("","requires DVIPS to be installed on your system,");
hl("","see www.radicaleye.com for further info.");
hl("  -e, --eps","When compiling the generated TeX code, generate");
hl("","Encapsulated PostScript (EPS) instead of the");
hl("","regular PostScript.");
hl("  -d, --dvipsopts <str>","When compiling the generated TeX code, use");
hl("","<str> as options to be supplied to DVIPS.");
hl("","In order to parse for an arbitrary number of");
hl("","DVIPS options at the command line, it is");
hl("","important to enclose the list of DVIPS options");
hl("","by quotes. Hence, for example, to force DVIPS");
hl("","to generate output pages of US letter format");
hl("","and at a resolution of 720 dpi one could invoke");
hl("","DVLABEL with");
hl("","  dvlabel --dvipsopts \"-tletter -D720\"");
hl("","The quotes are only necessary if the number of");
hl("","DVIPS options are two or more.");
hl("","Default: -D1200 -ta4 (1200 DPI on A4 paper).");
hl("  -v, --verbose","Toggle verbose mode. Default: off");
hl("  -h, --help","Display this help message and exit clean.");
fhl("\nCopyright (C) 2003-2005 Fredrik Jonsson <fj@phys.soton.ac.uk>");
}

/*:11*/
#line 493 "./dvlabel.w"


/*:8*/
#line 484 "./dvlabel.w"

/*12:*/
#line 595 "./dvlabel.w"

short newlabel(FILE*instream){
char ch;
fprintf(stdout,"Create new label record or quit?\n");
fprintf(stdout,"['n'=new label / 'q'=quit]:\n");
fprintf(stdout,"**");
while((ch= fgetc(instream))==' ');
if(ch=='n'){
while((ch= fgetc(instream))!='\n');
return(1);
}else if(ch=='q'){
while((ch= fgetc(instream))!='\n');
return(0);
}else{
fprintf(stderr,"%s: Unrecognized input stream control character '%c'.\n",
progname,ch);
exit(FAILURE);
}
}

/*:12*/
#line 485 "./dvlabel.w"

/*13:*/
#line 624 "./dvlabel.w"

/*14:*/
#line 634 "./dvlabel.w"

short alphanumeric(char ch){
if((ch=='0')||(ch=='1')||(ch=='2')||(ch=='3')||(ch=='4')||(ch=='5')
||(ch=='6')||(ch=='7')||(ch=='8')||(ch=='9')||(ch=='+')||(ch=='-')
||(ch=='a')||(ch=='b')||(ch=='c')||(ch=='d')||(ch=='e')||(ch=='f')
||(ch=='g')||(ch=='h')||(ch=='i')||(ch=='j')||(ch=='k')||(ch=='l')
||(ch=='m')||(ch=='n')||(ch=='o')||(ch=='p')||(ch=='q')||(ch=='r')
||(ch=='s')||(ch=='t')||(ch=='u')||(ch=='v')||(ch=='w')
||(ch=='x')||(ch=='y')||(ch=='z')){
return(1);
}else{
return(0);
}
}

/*:14*/
#line 625 "./dvlabel.w"

/*15:*/
#line 654 "./dvlabel.w"

short pathcharacter(char ch){
if(alphanumeric(ch)||(ch=='.')||(ch=='/')||(ch=='\\')||(ch=='_')||
(ch=='-')||(ch=='+')){
return(1);
}else{
return(0);
}
}

/*:15*/
#line 626 "./dvlabel.w"

/*16:*/
#line 670 "./dvlabel.w"

char*strip_away_path(char filename[]){
int j,k= 0;
char*stripped_filename[80];
while(pathcharacter(filename[k]))k++;
k--;
j= k;
while(alphanumeric(filename[j]))j--;
j++;
*stripped_filename= &filename[j];
return(*stripped_filename);
}

/*:16*/
#line 627 "./dvlabel.w"


/*:13*/
#line 486 "./dvlabel.w"


/*:7*/
#line 431 "./dvlabel.w"


int main(int argc,char*argv[])
{
/*17:*/
#line 688 "./dvlabel.w"

time_t now= time(NULL);
long j,k,n,num_address_lines,num_toc_lines,num_labels,num_labels_per_page= 4;
int no_arg,tmpch;
FILE*infile= NULL,*outfile= NULL;
char inputfilename[MAXCHAR]= "",outputfilename[MAXCHAR]= "",tmpstr[MAXCHAR];
char dvipsopts[MAXCHAR]= DEFAULT_DVIPSOPTS;
char timestamp[MAXCHAR]= "\today",title[MAXCHAR]= "";
char author[MAXCHAR]= "",email[MAXCHAR]= "";
char address[10*MAXCHAR]= "",toc[50*MAXCHAR]= "";
short done,verbose= 0,compile= 0,eps_output= 0;
short headline= 1,generate_crop_marks= 1;
short infile_specified= 0,outfile_specified= 0,dvipsopts_specified= 0;
float linethickness= DEFAULT_LINETHICKNESS;
float clthick= DEFAULT_CROPLINETHICKNESS;
float edgeseparation= DEFAULT_EDGESEPARATION;
float facewidth,faceheight,spineheight,flapheight;
float ifacewidth,ifaceheight,ispineheight,iflapheight;


/*:17*/
#line 435 "./dvlabel.w"

/*18:*/
#line 714 "./dvlabel.w"

{
progname= strip_away_path(argv[0]);
no_arg= argc;
while(--argc){
if(!strcmp(argv[no_arg-argc],"-o")||
!strcmp(argv[no_arg-argc],"--outputfile")){
--argc;
strcpy(outputfilename,argv[no_arg-argc]);
outfile_specified= 1;
}else if(!strcmp(argv[no_arg-argc],"-i")||
!strcmp(argv[no_arg-argc],"--inputfile")){
--argc;
strcpy(inputfilename,argv[no_arg-argc]);
infile_specified= 1;
}else if(!strcmp(argv[no_arg-argc],"-v")||
!strcmp(argv[no_arg-argc],"--verbose")){
verbose= (verbose?0:1);
}else if(!strcmp(argv[no_arg-argc],"-h")||
!strcmp(argv[no_arg-argc],"--help")){
showsomehelp();
exit(SUCCESS);
}else if(!strcmp(argv[no_arg-argc],"-H")||
!strcmp(argv[no_arg-argc],"--headline")){
headline= (headline?0:1);
}else if(!strcmp(argv[no_arg-argc],"-C")||
!strcmp(argv[no_arg-argc],"--cropmarks")){
generate_crop_marks= (generate_crop_marks?0:1);
}else if(!strcmp(argv[no_arg-argc],"-t")||
!strcmp(argv[no_arg-argc],"--linethick")){
--argc;
if(!sscanf(argv[no_arg-argc],"%f",&linethickness)){
fprintf(stderr,"%s: Error in linethickness argument.\n",progname);
exit(1);
}
}else if(!strcmp(argv[no_arg-argc],"-s")||
!strcmp(argv[no_arg-argc],"--edgeseparation")){
--argc;
if(!sscanf(argv[no_arg-argc],"%f",&edgeseparation)){
fprintf(stderr,"%s: Error in edgeseparation argument.\n",progname);
exit(1);
}
}else if(!strcmp(argv[no_arg-argc],"-c")||
!strcmp(argv[no_arg-argc],"--compile")){
compile= (compile?0:1);
}else if(!strcmp(argv[no_arg-argc],"-e")||
!strcmp(argv[no_arg-argc],"--eps")){
eps_output= (eps_output?0:1);
}else if(!strcmp(argv[no_arg-argc],"-d")||
!strcmp(argv[no_arg-argc],"--dvipsopts")){
--argc;
strcpy(dvipsopts,argv[no_arg-argc]);
dvipsopts_specified= 1;
}else{
fprintf(stderr,"%s: Unknown option '%s'.\n",
progname,argv[no_arg-argc]);
showsomehelp();
exit(FAILURE);
}
}
if(verbose&&!outfile_specified){
fprintf(stdout,
"You have specified verbose mode without any specification of\n"
"a file where to save the generated TeX source code. This means\n"
"that any program comments that appear, due to the verbose mode,\n"
"will be mixed with the source code. It is highly recommended that\n"
"you either turn off verbose mode or specify a file where to save\n"
"the generated output (using the -o or --outputfile option).\n");
fprintf(stdout,
"In order to make a clean output, the TeX code is separately\n"
"enclosed in the blocks below.\n");
}
if(verbose&&dvipsopts_specified){
fprintf(stdout,"Specified options for later use with DVIPS: ");
fprintf(stdout,"%s\n",dvipsopts);
}
}

/*:18*/
#line 436 "./dvlabel.w"

/*19:*/
#line 794 "./dvlabel.w"

{
fprintf(stdout,"This is %s, Version %s\n",progname,VERSION);
}

/*:19*/
#line 437 "./dvlabel.w"

/*21:*/
#line 812 "./dvlabel.w"

{
if(infile_specified){
if((infile= fopen(inputfilename,"r"))==NULL){
if((infile= fopen(strcat(inputfilename,".dvl"),"r"))==NULL){
fprintf(stderr,"%s: Could not open file %s for reading!\n",
progname,inputfilename);
exit(FAILURE);
}
}
fseek(infile,0L,SEEK_SET);
if(verbose){
fprintf(stderr,"%s: Opened input file %s for reading.\n",
progname,inputfilename);
}
}else{
if(verbose){
fprintf(stderr,"%s: No input filename specified.\n",progname);
fprintf(stderr,"%s: Entering interactive mode.\n",progname);
}
}
}

/*:21*/
#line 438 "./dvlabel.w"

/*22:*/
#line 837 "./dvlabel.w"

{
if(outfile_specified){
sprintf(tmpstr,"%s.tex",outputfilename);
if((outfile= fopen(tmpstr,"w"))==NULL){
fprintf(stderr,"%s: Could not open file %s for writing!\n",
progname,tmpstr);
exit(FAILURE);
}
fseek(outfile,0L,SEEK_SET);
if(verbose){
fprintf(stderr,"%s: Opened output file %s for writing.\n",
progname,outputfilename);
}
}else{
if(verbose){
fprintf(stderr,"%s: No output filename specified.\n",progname);
fprintf(stderr,
"%s: Will write generated TeX output to standard terminal output\n",
progname);
}
}
}

/*:22*/
#line 439 "./dvlabel.w"

/*32:*/
#line 1087 "./dvlabel.w"

{
facewidth= 190.6+3.0*72.27/25.4;
faceheight= 133.7;
spineheight= 35.6;
flapheight= 41.3;
ifacewidth= facewidth-14.0*linethickness;
ifaceheight= faceheight-11.0*linethickness-0.5*edgeseparation;
ispineheight= spineheight-8.0*linethickness-edgeseparation;
iflapheight= flapheight-11.0*linethickness-0.5*edgeseparation;
if(!outfile_specified)
fprintf(OUTSTREAM,"%%-------- TEX CODE BEGINS HERE -----------------\n");
fprintf(OUTSTREAM,"%% File: %s.tex\n",outputfilename);
fprintf(OUTSTREAM,"%% TeX code generated by %s, v.%s, %s",
progname,VERSION,ctime(&now));
fprintf(OUTSTREAM,"%% Copyright (C) Fredrik Jonsson, 2003-2005\n%%\n");
fprintf(OUTSTREAM,"\\hoffset=-35pt\\voffset=-25pt\n");
fprintf(OUTSTREAM,"\\hsize=175mm\\vsize=254mm\n");
fprintf(OUTSTREAM,"\\font\\eightcmssqeight=cmssq8\n");
fprintf(OUTSTREAM,"\\font\\sevencmtt=cmtt7\n");
fprintf(OUTSTREAM,"\\font\\tencmssqten=cmssq8 at 10 truept\n");
fprintf(OUTSTREAM,"\\font\\deffacefont=cmr7\n");
fprintf(OUTSTREAM,"\\font\\deftimestampfont=cmtt8 at 7 truept\n");
fprintf(OUTSTREAM,"\\font\\defspinefont=cmr9\n");
fprintf(OUTSTREAM,"\\font\\defflapfont=cmr7\n");
fprintf(OUTSTREAM,"\\def\\monthname{\\ifcase\\month%%\n");
fprintf(OUTSTREAM," \\or Jan\\or Feb\\or Mar\\or Apr\\or May\\or Jun%%\n");
fprintf(OUTSTREAM," \\or Jul\\or Aug\\or Sep\\or Oct\\or Nov\\or Dec%%\n");
fprintf(OUTSTREAM," \\fi}\n");
fprintf(OUTSTREAM,"\\def\\fullmonthname{\\ifcase\\month%%\n");
fprintf(OUTSTREAM," \\or January\\or February\\or March\\or April%%\n");
fprintf(OUTSTREAM," \\or May\\or June\\or July\\or August\\or September\n");
fprintf(OUTSTREAM," \\or October\\or November\\or December\\fi}\n");
fprintf(OUTSTREAM,"\\def\\today{\\fullmonthname\\space\\number\\day,%%\n");
fprintf(OUTSTREAM,"  \\space\\number\\year}\n");
fprintf(OUTSTREAM,"\\def\\dvby{Digital Video by\\ }\n");
fprintf(OUTSTREAM,"\\parindent 0pt\n");
fprintf(OUTSTREAM,"\\newdimen\\facewidth\n");
fprintf(OUTSTREAM,"\\newdimen\\faceheight\n");
fprintf(OUTSTREAM,"\\newdimen\\spineheight\n");
fprintf(OUTSTREAM,"\\newdimen\\flapheight\n");
fprintf(OUTSTREAM,"\\newdimen\\linethick\n");
fprintf(OUTSTREAM,"\\newdimen\\spacethick\n");
fprintf(OUTSTREAM,"\\newdimen\\edgeseparation\n");
fprintf(OUTSTREAM,"\\newdimen\\cropthick\n");
fprintf(OUTSTREAM,"\\facewidth=%1.3fpt\n",facewidth);
fprintf(OUTSTREAM,"\\faceheight=%1.3fpt\n",faceheight);
fprintf(OUTSTREAM,"\\spineheight=%1.3fpt\n",spineheight);
fprintf(OUTSTREAM,"\\flapheight=%1.3fpt\n",flapheight);
fprintf(OUTSTREAM,"\\linethick=%1.3fpt\n",linethickness);
fprintf(OUTSTREAM,"\\spacethick=%1.3fpt\n",2.0*linethickness);
fprintf(OUTSTREAM,"\\edgeseparation=%1.3fpt\n",edgeseparation);
fprintf(OUTSTREAM,"\\cropthick=%1.3fpt\n",clthick);
if(headline){
fprintf(OUTSTREAM,"\\headline={\\hfill{\\tt dvlabel output");
fprintf(OUTSTREAM," %s",ctime(&now));
fprintf(OUTSTREAM," [%s]}}\n",(infile_specified?inputfilename:"stdin"));
fprintf(OUTSTREAM,"\\footline={\\hfill\\folio\\hfill}\n");
}else{
fprintf(OUTSTREAM,"\\headline={\\hfil}\n");
fprintf(OUTSTREAM,"\\nopagenumbers\n");
}
fprintf(OUTSTREAM,"\\def\\boxit#1{\\vbox{\\hrule height\\linethick%%\n");
fprintf(OUTSTREAM,"  \\hbox{\\vrule width\\linethick\\kern\\spacethick%%\n");
fprintf(OUTSTREAM,"  \\vbox{\\kern\\spacethick#1\\kern\\spacethick}%%\n");
fprintf(OUTSTREAM,"  \\kern\\spacethick\\vrule width\\linethick}%%\n");
fprintf(OUTSTREAM,"  \\hrule height\\linethick}}%%\n");
}

/*:32*/
#line 440 "./dvlabel.w"

num_labels= 0;
while(newlabel(INSTREAM)){
num_labels++;
/*25:*/
#line 888 "./dvlabel.w"

{
/*26:*/
#line 905 "./dvlabel.w"

{
fprintf(stdout,"Specify table of contents of the DV tape\n");
fprintf(stdout,"[Enter text and finish with single dot on blank line]:\n");
done= 0;
n= 0;
num_toc_lines= 0;
while(!done){
fprintf(stdout,"**");
while((tmpch= fgetc(INSTREAM))==' ');
ungetc(tmpch,INSTREAM);
k= 0;
while((tmpstr[k++]= fgetc(INSTREAM))!='\n');
if(k> 1){
if((tmpstr[0]=='.')&&(tmpstr[1]=='\n')){
done= 1;
}else{
for(j= 0;j<k;j++)toc[n+j]= tmpstr[j];
if(1==0)toc[n+j]= '\n';
n= n+j;
num_toc_lines++;
}
}else{
toc[n]= '\n';
}
}
if(verbose){
fprintf(stdout,"%s: Counted %ld number of table-of-contents lines.\n",
progname,num_toc_lines);
fprintf(stdout,"Table of contents:\n");
n= 0;
for(k= 1;k<=num_toc_lines;k++){
for(j= n;toc[j]!='\n';j++)fprintf(stdout,"%c",toc[j]);
fprintf(stdout,"\n");
n= j+1;
}
}
}

/*:26*/
#line 890 "./dvlabel.w"

/*27:*/
#line 946 "./dvlabel.w"

{
fprintf(stdout,"Specify time stamp of DV tape. This is typically\n");
fprintf(stdout,"the last date that appears as time stamp in the\n");
fprintf(stdout,"recorded tape. [Press enter to use the current date]\n");
fprintf(stdout,"**");
while((tmpch= fgetc(INSTREAM))==' ');
ungetc(tmpch,INSTREAM);
k= 0;
while((tmpstr[k++]= fgetc(INSTREAM))!='\n');
if(k> 1)
for(j= 0;j<k;j++)timestamp[j]= tmpstr[j];
else
for(j= 0;j<7;j++)timestamp[j]= "\\today\n"[j];
if(verbose){
fprintf(stdout,"Time stamp: ");
for(j= 0;timestamp[j]!='\n';j++)fprintf(stdout,"%c",timestamp[j]);
fprintf(stdout,"\n");
}
}

/*:27*/
#line 891 "./dvlabel.w"

/*28:*/
#line 969 "./dvlabel.w"

{
fprintf(stdout,
"Specify title of the DV tape [Press enter to leave blank title]:\n");
fprintf(stdout,"**");
while((tmpch= fgetc(INSTREAM))==' ');
ungetc(tmpch,INSTREAM);
k= 0;
while((tmpstr[k++]= fgetc(INSTREAM))!='\n');
if(k> 1)
for(j= 0;j<k;j++)title[j]= tmpstr[j];
else
title[0]= '\n';
if(verbose){
fprintf(stdout,"Title: ");
for(j= 0;title[j]!='\n';j++)fprintf(stdout,"%c",title[j]);
fprintf(stdout,"\n");
}
}

/*:28*/
#line 892 "./dvlabel.w"

/*29:*/
#line 991 "./dvlabel.w"

{
fprintf(stdout,
"Specify author of the DV tape [Press enter to leave blank]:\n");
fprintf(stdout,"**");
while((tmpch= fgetc(INSTREAM))==' ');
ungetc(tmpch,INSTREAM);
k= 0;
while((tmpstr[k++]= fgetc(INSTREAM))!='\n');
if(k> 1)
for(j= 0;j<k;j++)author[j]= tmpstr[j];
else
author[0]= '\n';
if(verbose){
fprintf(stdout,"Author: ");
for(j= 0;author[j]!='\n';j++)fprintf(stdout,"%c",author[j]);
fprintf(stdout,"\n");
}
}

/*:29*/
#line 893 "./dvlabel.w"

/*30:*/
#line 1018 "./dvlabel.w"

{
fprintf(stdout,"Specify address of author of the DV tape\n");
fprintf(stdout,"[Enter text and finish with single dot on blank line]:\n");
fprintf(stdout,"**");
done= 0;
n= 0;
num_address_lines= 0;
while(!done){
while((tmpch= fgetc(INSTREAM))==' ');
ungetc(tmpch,INSTREAM);
k= 0;
while((tmpstr[k++]= fgetc(INSTREAM))!='\n');
if(k> 1){
if((tmpstr[0]=='.')&&(tmpstr[1]=='\n')){
done= 1;
}else{
for(j= 0;j<k;j++)address[n+j]= tmpstr[j];
if(1==0)address[n+j]= '\n';
n= n+j;
num_address_lines++;
}
}else{
address[n]= '\n';
}
fprintf(stdout,"**");
}
if(verbose){
fprintf(stdout,"%s: Counted %ld address lines.\n",
progname,num_address_lines);
fprintf(stdout,"Address:\n");
n= 0;
for(k= 1;k<=num_address_lines;k++){
for(j= n;address[j]!='\n';j++)fprintf(stdout,"%c",address[j]);
fprintf(stdout,"\n");
n= j+1;
}
}
}

/*:30*/
#line 894 "./dvlabel.w"

/*31:*/
#line 1060 "./dvlabel.w"

{
fprintf(stdout,
"Specify email of author of the DV tape [Press enter to leave blank]:\n");
fprintf(stdout,"**");
while((tmpch= fgetc(INSTREAM))==' ');
ungetc(tmpch,INSTREAM);
k= 0;
while((tmpstr[k++]= fgetc(INSTREAM))!='\n');
if(k> 1)
for(j= 0;j<k;j++)email[j]= tmpstr[j];
else
email[0]= '\n';
if(verbose){
fprintf(stdout,"Email: ");
for(j= 0;email[j]!='\n';j++)fprintf(stdout,"%c",email[j]);
fprintf(stdout,"\n");
}
}

/*:31*/
#line 895 "./dvlabel.w"

}

/*:25*/
#line 444 "./dvlabel.w"

if(num_labels==1){
if(generate_crop_marks){
/*35:*/
#line 1228 "./dvlabel.w"

{
fprintf(OUTSTREAM,"\\hskip %1.3fpt\\vrule height20pt width%1.3fpt%%\n",
20.0-clthick/2.0,clthick);
fprintf(OUTSTREAM,"\\hbox to%1.3fpt{\\hfil",facewidth-clthick);
fprintf(OUTSTREAM,"$\\matrix{{%1.3f{\\rm\\ pt}/%1.3f{\\rm\\ mm}}"
"\\cr{}\\cr}$\\hfil}%%\n",facewidth,facewidth*(25.4/72.27));
fprintf(OUTSTREAM,"\\vrule height20pt width%1.3fpt%%\n",clthick);
fprintf(OUTSTREAM,"\\hbox to %1.3fpt{\\hfil",facewidth-clthick);
fprintf(OUTSTREAM,"$\\matrix{{%1.3f{\\rm\\ pt}/%1.3f{\\rm\\ mm}}"
"\\cr{}\\cr}$\\hfil}%%\n",facewidth,facewidth*(25.4/72.27));
fprintf(OUTSTREAM,"\\vrule height20pt width%1.3fpt\\par\\nointerlineskip\n",
clthick);
}

/*:35*/
#line 447 "./dvlabel.w"

/*36:*/
#line 1247 "./dvlabel.w"

{
fprintf(OUTSTREAM,"\\vskip\\linethick\n");
fprintf(OUTSTREAM,"\\vrule height%1.3fpt width20pt",clthick);
fprintf(OUTSTREAM,"\\hskip %1.3fpt",2.0*facewidth);
fprintf(OUTSTREAM,"\\vrule height%1.3fpt width20pt\\par\\nointerlineskip\n",
clthick);
fprintf(OUTSTREAM,"\\vskip\\linethick\n");
}

/*:36*/
#line 448 "./dvlabel.w"

}
}
/*33:*/
#line 1158 "./dvlabel.w"

{
fprintf(OUTSTREAM,"\\def\\timestamp{");
for(j= 0;timestamp[j]!='\n';j++)fprintf(OUTSTREAM,"%c",timestamp[j]);
fprintf(OUTSTREAM,"}%%\n");
fprintf(OUTSTREAM,"\\def\\title{");
for(j= 0;title[j]!='\n';j++)fprintf(OUTSTREAM,"%c",title[j]);
fprintf(OUTSTREAM,"}%%\n");
fprintf(OUTSTREAM,"\\def\\author{");
for(j= 0;author[j]!='\n';j++)fprintf(OUTSTREAM,"%c",author[j]);
fprintf(OUTSTREAM,"}%%\n");
fprintf(OUTSTREAM,"\\def\\email{");
for(j= 0;email[j]!='\n';j++)fprintf(OUTSTREAM,"%c",email[j]);
fprintf(OUTSTREAM,"}%%\n");
fprintf(OUTSTREAM,"%% Define the outline of the face of the label\n");
fprintf(OUTSTREAM,"\\setbox1=\\hbox to %1.3fpt{{%%\n",ifacewidth);
fprintf(OUTSTREAM,"  \\vbox to \\faceheight{%%\n");
fprintf(OUTSTREAM,"    \\hbox{\\deffacefont\\timestamp\\hfil}%%\n");
n= 0;
for(k= 1;k<=num_toc_lines;k++){
fprintf(OUTSTREAM,"    \\vskip -3pt\\hbox{\\deffacefont ");
for(j= n;toc[j]!='\n';j++)fprintf(OUTSTREAM,"%c",toc[j]);
fprintf(OUTSTREAM,"\\hfil}%%\n");
n= j+1;
}
fprintf(OUTSTREAM,"  \\vfil}}\\hfil}%%\n");
fprintf(OUTSTREAM,"%% Define the outline of the spine of the label\n");
fprintf(OUTSTREAM,"\\setbox2=\\hbox to %1.3fpt{{%%\n",ifacewidth);
fprintf(OUTSTREAM,"  \\vbox to %1.3fpt{%%\n",ispineheight);
fprintf(OUTSTREAM,"    \\hbox{\\deftimestampfont\\timestamp\\hfil}%%\n");
fprintf(OUTSTREAM,"    \\hbox{\\defspinefont\\title\\hfil}%%\n");
fprintf(OUTSTREAM,"  \\vfil}}\\hfil}%%\n");
fprintf(OUTSTREAM,"%% Define the outline of the flap of the label\n");
fprintf(OUTSTREAM,"\\setbox3=\\hbox to %1.3fpt{{%%\n",ifacewidth);
fprintf(OUTSTREAM,"  \\vbox to %1.3fpt{%%\n",iflapheight);
fprintf(OUTSTREAM,"    \\hbox{\\defflapfont\\dvby\\author\\hfil}%%\n");
n= 0;
for(k= 1;k<=num_address_lines;k++){
fprintf(OUTSTREAM,"    \\vskip -3pt\\hbox{\\defflapfont ");
for(j= n;address[j]!='\n';j++)fprintf(OUTSTREAM,"%c",address[j]);
fprintf(OUTSTREAM,"\\hfil}\n");
n= j+1;
}
fprintf(OUTSTREAM,"    \\vskip -3pt\\hbox{\\defflapfont\\email\\hfil}%%\n");
fprintf(OUTSTREAM,"  \\vfil}}\\hfil}%%\n");
fprintf(OUTSTREAM,"\\def\\dvlabel{\\hskip\\linethick\\boxit{%%\n");
fprintf(OUTSTREAM,"  \\boxit{\\box1}\\vskip\\edgeseparation%%\n");
fprintf(OUTSTREAM,"  \\boxit{\\box2}\\vskip\\edgeseparation%%\n");
fprintf(OUTSTREAM,"  \\boxit{\\box3}}\\hskip\\linethick}%%\n");
if((num_labels==1)||(num_labels==3))fprintf(OUTSTREAM,"\\hskip %1.3fpt",
(20.0));
fprintf(OUTSTREAM,"\\dvlabel\n");
if((num_labels==2)||(num_labels==4)||(num_labels==6)){
fprintf(OUTSTREAM,"\\par\\nointerlineskip\n");
}
}

/*:33*/
#line 451 "./dvlabel.w"

if(num_labels==2){
if(generate_crop_marks){
/*36:*/
#line 1247 "./dvlabel.w"

{
fprintf(OUTSTREAM,"\\vskip\\linethick\n");
fprintf(OUTSTREAM,"\\vrule height%1.3fpt width20pt",clthick);
fprintf(OUTSTREAM,"\\hskip %1.3fpt",2.0*facewidth);
fprintf(OUTSTREAM,"\\vrule height%1.3fpt width20pt\\par\\nointerlineskip\n",
clthick);
fprintf(OUTSTREAM,"\\vskip\\linethick\n");
}

/*:36*/
#line 454 "./dvlabel.w"

}
}
if(num_labels==num_labels_per_page){
if(generate_crop_marks){
/*36:*/
#line 1247 "./dvlabel.w"

{
fprintf(OUTSTREAM,"\\vskip\\linethick\n");
fprintf(OUTSTREAM,"\\vrule height%1.3fpt width20pt",clthick);
fprintf(OUTSTREAM,"\\hskip %1.3fpt",2.0*facewidth);
fprintf(OUTSTREAM,"\\vrule height%1.3fpt width20pt\\par\\nointerlineskip\n",
clthick);
fprintf(OUTSTREAM,"\\vskip\\linethick\n");
}

/*:36*/
#line 459 "./dvlabel.w"

/*35:*/
#line 1228 "./dvlabel.w"

{
fprintf(OUTSTREAM,"\\hskip %1.3fpt\\vrule height20pt width%1.3fpt%%\n",
20.0-clthick/2.0,clthick);
fprintf(OUTSTREAM,"\\hbox to%1.3fpt{\\hfil",facewidth-clthick);
fprintf(OUTSTREAM,"$\\matrix{{%1.3f{\\rm\\ pt}/%1.3f{\\rm\\ mm}}"
"\\cr{}\\cr}$\\hfil}%%\n",facewidth,facewidth*(25.4/72.27));
fprintf(OUTSTREAM,"\\vrule height20pt width%1.3fpt%%\n",clthick);
fprintf(OUTSTREAM,"\\hbox to %1.3fpt{\\hfil",facewidth-clthick);
fprintf(OUTSTREAM,"$\\matrix{{%1.3f{\\rm\\ pt}/%1.3f{\\rm\\ mm}}"
"\\cr{}\\cr}$\\hfil}%%\n",facewidth,facewidth*(25.4/72.27));
fprintf(OUTSTREAM,"\\vrule height20pt width%1.3fpt\\par\\nointerlineskip\n",
clthick);
}

/*:35*/
#line 460 "./dvlabel.w"

}
/*34:*/
#line 1219 "./dvlabel.w"

{
fprintf(OUTSTREAM,"\\vfill\\eject\n");
}

/*:34*/
#line 462 "./dvlabel.w"

num_labels= 0;
}
}
/*37:*/
#line 1259 "./dvlabel.w"

{
if((num_labels!=2)&&(num_labels!=4)){
fprintf(OUTSTREAM,"\\par\\nointerlineskip\n");
}
if(num_labels!=num_labels_per_page){
if(num_labels!=0){
if(generate_crop_marks){
/*36:*/
#line 1247 "./dvlabel.w"

{
fprintf(OUTSTREAM,"\\vskip\\linethick\n");
fprintf(OUTSTREAM,"\\vrule height%1.3fpt width20pt",clthick);
fprintf(OUTSTREAM,"\\hskip %1.3fpt",2.0*facewidth);
fprintf(OUTSTREAM,"\\vrule height%1.3fpt width20pt\\par\\nointerlineskip\n",
clthick);
fprintf(OUTSTREAM,"\\vskip\\linethick\n");
}

/*:36*/
#line 1267 "./dvlabel.w"

/*35:*/
#line 1228 "./dvlabel.w"

{
fprintf(OUTSTREAM,"\\hskip %1.3fpt\\vrule height20pt width%1.3fpt%%\n",
20.0-clthick/2.0,clthick);
fprintf(OUTSTREAM,"\\hbox to%1.3fpt{\\hfil",facewidth-clthick);
fprintf(OUTSTREAM,"$\\matrix{{%1.3f{\\rm\\ pt}/%1.3f{\\rm\\ mm}}"
"\\cr{}\\cr}$\\hfil}%%\n",facewidth,facewidth*(25.4/72.27));
fprintf(OUTSTREAM,"\\vrule height20pt width%1.3fpt%%\n",clthick);
fprintf(OUTSTREAM,"\\hbox to %1.3fpt{\\hfil",facewidth-clthick);
fprintf(OUTSTREAM,"$\\matrix{{%1.3f{\\rm\\ pt}/%1.3f{\\rm\\ mm}}"
"\\cr{}\\cr}$\\hfil}%%\n",facewidth,facewidth*(25.4/72.27));
fprintf(OUTSTREAM,"\\vrule height20pt width%1.3fpt\\par\\nointerlineskip\n",
clthick);
}

/*:35*/
#line 1268 "./dvlabel.w"

}
}
/*34:*/
#line 1219 "./dvlabel.w"

{
fprintf(OUTSTREAM,"\\vfill\\eject\n");
}

/*:34*/
#line 1271 "./dvlabel.w"

}
fprintf(OUTSTREAM,"\\bye\n");
if(!outfile_specified)
fprintf(OUTSTREAM,"%%-------- TEX CODE ENDS HERE -----------------\n");
}

/*:37*/
#line 466 "./dvlabel.w"

/*23:*/
#line 863 "./dvlabel.w"

{
if(infile_specified)fclose(infile);
if(outfile_specified)fclose(outfile);
}

/*:23*/
#line 467 "./dvlabel.w"

/*38:*/
#line 1290 "./dvlabel.w"

{
if(compile){
if(verbose){
fprintf(stdout,"%s: Compiling the TeX source code into PostScript.\n",
progname);
}
if(outfile_specified){
if(eps_output){
sprintf(tmpstr,"tex %s; dvips %s %s -E -o %s.eps",
outputfilename,dvipsopts,outputfilename,outputfilename);
}else{
sprintf(tmpstr,"tex %s; dvips %s %s -o %s.ps",
outputfilename,dvipsopts,outputfilename,outputfilename);
}
system(tmpstr);
}else{
fprintf(stdout,"Compiling terminal output: Not implemented yet.\n");
exit(FAILURE);
}
}
}

/*:38*/
#line 468 "./dvlabel.w"

return(SUCCESS);
}

/*:5*/


Return to previous page

Last modified 15 Dec 2009