|
|
1.1 root 1: /* e_main.c - make the encoding routines into a stand alone program */
2:
3: #ifndef lint
4: static char *rcsid = "$Header: /f/osi/others/quipu/photo/RCS/e_main.c,v 7.0 89/11/23 22:01:38 mrose Rel $";
5: #endif
6:
7: /*
8: * $Header: /f/osi/others/quipu/photo/RCS/e_main.c,v 7.0 89/11/23 22:01:38 mrose Rel $
9: *
10: *
11: * $Log: e_main.c,v $
12: * Revision 7.0 89/11/23 22:01:38 mrose
13: * Release 6.0
14: *
15: */
16:
17: /*
18: * NOTICE
19: *
20: * Acquisition, use, and distribution of this module and related
21: * materials are subject to the restrictions of a license agreement.
22: * Consult the Preface in the User's Manual for the full terms of
23: * this agreement.
24: *
25: */
26:
27:
28:
29: #include <stdio.h>
30: #include "quipu/photo.h"
31: #include <pixrect/pixrect_hs.h>
32:
33: struct pixrect *pr_load();
34:
35: extern int PIC_LINESIZE;
36: extern int STOP;
37: extern int NUMLINES;
38: extern int optlen;
39:
40: /* ROUTINE: main
41: /*
42: /* DESCRIPTION: Interprets the command line parameters then calls the
43: /* encoding routine. The format of the command line is as follows:-
44: /*
45: /* encode [-K] infile outfile
46: /*
47: /* -K is the K parameter default 1
48: /* if infile or outfile omitted then stdin or stdout is used.
49: */
50: char * encode_t4 ();
51:
52: main (argc,argv)
53: int argc;
54: char ** argv;
55:
56: {
57: int k_param = 1;
58: int length;
59: char * inbuf;
60: char * outbuf;
61: FILE * fptr;
62: struct pixrect *pix;
63: struct mpr_data *src_mpr;
64: int skip;
65:
66: argv++;
67:
68: if ( (argc > 1) && (**argv == '-')) {
69: switch (*++*argv) {
70: case '1': k_param = 1;break;
71: case '2': k_param = 2;break;
72: case '4': k_param = 4;break;
73: case 'n': k_param = 1;break;
74: case 'l': k_param = 2;break;
75: case 'h': k_param = 4;break;
76: case 'v': k_param = 32767;break;
77: default : (void) fprintf (stderr,"Usage: %s -[124nlhv] \n",argv[0]);
78: exit (-1);
79: }
80: argv++;
81: argc--;
82: }
83:
84:
85: if ((pix = pr_load (stdin, NULL)) == (struct pixrect *)NULL)
86: (void) fprintf (stderr,"Not a pixrect.\n");
87:
88:
89: PIC_LINESIZE = pix->pr_size.x;
90: STOP = PIC_LINESIZE + 1;
91: NUMLINES = pix->pr_size.y;
92:
93: src_mpr = (struct mpr_data *)(pix->pr_data);
94: inbuf = (char *) src_mpr->md_image;
95:
96: skip = 16 - (PIC_LINESIZE % 16);
97: if (skip == 16) skip = 0;
98:
99: outbuf = encode_t4 (k_param,inbuf,skip);
100:
101: *(outbuf + optlen) = 0;
102: fwrite (outbuf,optlen+1,1,stdout);
103:
104: }
105:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.