home *** CD-ROM | disk | FTP | other *** search
- /*
- * 78code2c - Convert encodings file to C code
- */
-
- #ifndef lint
- static char _cpyrgt[] = "Copyright 1989 Howard Lee Gayle";
- #endif lint
-
- /*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 1,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
- #include <stdio.h>
- #include <howard/port.h>
- #include <howard/version.h>
- #include <howard/usage.h>
-
- MAINVER ("@(#)$Header: 78code2c.c,v 1.2 89/08/26 13:25:59 howard Exp $");
- USAGE ("encodings > c-code");
-
- #include <string.h>
- #include <howard/malf.h>
- #include <howard/registers.i>
- #include "cz.h"
- #include "78.h"
- #include "78code.h"
-
- /* main - main function */
-
- PUBLIC int main (argc, argv)
- int argc; /* Number of arguments.*/
- bStrT *argv; /* Points to array of argument strings.*/
-
- /* Function:
- *
- * Algorithm:
- *
- * Notes:
- *
- */
-
- {
- R1 bStrT p1; /* Steps through byte2t[] and t2byte[].*/
- R2 bStrT p2; /* End of byte2t[] or t2byte[].*/
-
- if (2 != argc) usage();
- rdcode (argv[1]);
- PUTS ("PRIVATE byteT byte2t[256] = /* Map each byte to a trigram code.*/");
- PUTS ("{");
- p1 = byte2t;
- for (p2 = p1 + 256; p1 != p2; ++p1)
- PRINTF ("%d,\n", B(*p1));
- PUTS ("};\n");
- PUTS (
- "PRIVATE byteT t2byte[TRINONE] = /* Map trigram code to printable character.*/"
- );
- PUTS ("{");
- p1 = t2byte;
- for (p2 = p1 + TRINONE; p1 != p2; ++p1)
- PRINTF ("'%c',\n", (EOS == B(*p1)) ? '?' : B(*p1));
- PUTS ("};");
- mfflush (stdout, S("Standard Output"));
- exit (SUCCESS);
-
- #ifdef lint
- return (SUCCESS);
- #endif
- }
-